Re: [SQL] String concat operator???

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] String concat operator???
Дата
Msg-id 21995.930752286@sss.pgh.pa.us
обсуждение исходный текст
Ответ на String concat operator???  (webmaster <webmaster@tony.cz>)
Список pgsql-sql
webmaster <webmaster@tony.cz> writes:
> update temp_kat set id_look = substr(ident,1,6) || '-' || substr(ident,7,7)
> where from_kat='P'; 

> Both id_look and ident are varchars.. So what's wrong with || operator? There
> is an error parsing the querry near || ...

In 6.4.* you have to parenthesize the above because Postgres doesn't
assume that the operator || is associative:

update temp_kat set id_look = (substr(ident,1,6) || '-') || substr(ident,7,7)
where from_kat='P'; 

6.5 takes the query without parentheses...
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Herouth Maoz
Дата:
Сообщение: Re: [SQL] String concat operator???
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] More fun with random selects