我有一个字段称为标签的表可以包含任意数量的字符串更新文本[]字段:如何用绳子
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