我有一個字段稱爲標籤的表可以包含任意數量的字符串更新文本[]字段:如何用繩子
Table "public.page"
Column | Type | Modifiers
----------------------+--------------------------+----------------------------------
tags | text[] | not null default ARRAY[]::text[]
我想添加一個字符串變量場 - 但我似乎無法獲得concat函數爲我工作。我已經試過:
update page set tags=concat('My New String',tags);
ERROR: function concat(unknown, text[]) does not exist
LINE 1: update page set tags=concat('My New String',tags) where ...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
和
update page set tags=('My New String'||tags);
ERROR: operator is not unique: unknown || text[]
LINE 1: update page set tags = ('My New String' || tags) where w...
^
HINT: Could not choose a best candidate operator. You might need to add explicit type casts.
任何想法?
字符串「沒有運氣」不是PostgreSQL中內置的錯誤消息。 – 2013-08-29 16:08:43
'||'運算符*應該*工作。你收到什麼錯誤信息? –
嗯,出於某種原因,它不明白'我的新弦'應該是文本。嘗試鑄造它。 – 2013-08-29 16:16:58