Re: [SQL] String concat operator???

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: webmaster(at)tony(dot)cz
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] String concat operator???
Date: 1999-06-30 14:18:06
Message-ID: 21995.930752286@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

webmaster <webmaster(at)tony(dot)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

Browse pgsql-sql by date

  From Date Subject
Next Message Herouth Maoz 1999-06-30 14:19:28 Re: [PORTS] Port Bug Report: parse error not detected on unterminated quote
Previous Message Jeff MacDonald 1999-06-30 13:56:26 Re: [SQL] Port?