2016-03-07 49 views
0

我正在轉向使用Postgres和text []獲取關鍵字。我之前使用過csv字符串。結果,我的數據很難看,我舉了一個例子。清理Postgres文本數組

{Tor," granite"," rock formations"," landscape"," people"," men"," 1920s"," 20th century"," climbing"} 

有沒有修剪和清理數據,因此更像是這樣的一個簡單的方式

{Tor,granite,rock formations,landscape,people,men,1920s,20th century,climbing} 
+0

這只是一個VARCHAR列? –

+0

是的。 '標籤|文字[] |' – latitudehopper

回答

0

你可以做這樣的:

select replace(replace(yourField, '"', ''), ', ', ',') 
    from yourTable 

結果將是:

{Tor,granite,rock formations,landscape,people,men,1920s,20th century,climbing} 

看到它在這裏工作:http://sqlfiddle.com/#!15/ea962/1