Re: String concatenation operator which keeps trailing spaces in CHAR(n) columns

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: Andrus *EXTERN* <kobruleht2(at)hot(dot)ee>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: String concatenation operator which keeps trailing spaces in CHAR(n) columns
Date: 2014-07-30 11:59:18
Message-ID: A737B7A37273E048B164557ADEF4A58B17D214F4@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andrus wrote:
>> Use "bpchar" instead of "text" in the definition of function and operator.
>> Otherwise col1 gets cast to "text" and loses its trailing spaces.
>
> Thank you very much.
> It worked.
> Which notation to use for this ?
>
> Is it reasonable use "+" as such operator for strings or should some other
> notation used ?

The traditional concatenation operator name is ||, but I believe that it is
confusing to overwrite builtin operators.

You could use a name that does not show up in
SELECT DISTINCT oprname FROM pg_operator;

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-07-30 14:38:35 Re: pgbouncer not finding pidfile
Previous Message Andrus 2014-07-30 11:46:19 Re: String concatenation operator which keeps trailing spaces in CHAR(n) columns