Re: Simple concatenation in select query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Sandis" <sandis(at)mediaparks(dot)lv>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Simple concatenation in select query
Date: 2000-07-31 21:05:57
Message-ID: 13672.965077557@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Sandis" <sandis(at)mediaparks(dot)lv> writes:
> Ok, i got it, after all! It took > 30 min to write this query. :(
> SELECT textcat(textcat(first_name,text ' '),last_name) from table;

It's a lot easier if you use the SQL-standard concatenation operator:

regression=# select 'foo' || 'bar';
?column?
----------
foobar
(1 row)

textcat() just exists to implement the operator, which is why it's
not documented separately.

Dunno why you'd need to specify the type of the constant explicitly
in this context --- there is only one textcat function, so the system
ought to be able to figure it out.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Timothy Covell 2000-07-31 23:59:51 What's ETA for read/write Views?
Previous Message Henry Lafleur 2000-07-31 21:05:24 RE: Simple concatenation in select query