Re: CHAR(n) always trims trailing spaces in 7.4

From: elein <elein(at)varlena(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: elein <elein(at)varlena(dot)com>, "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>, "news(dot)postgresql(dot)org" <jlim(at)natsoft(dot)com(dot)my>, pgsql-sql(at)postgresql(dot)org
Subject: Re: CHAR(n) always trims trailing spaces in 7.4
Date: 2004-02-18 20:05:47
Message-ID: 20040218120547.J25537@cookie.varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

So exactly what is the order of casts that produces
different results with:

'x' || ' ' || 'x' and 'x' || ' '::char15 || 'x'

Are operators being invoked both (text,text)?

I'm trying to understand the precedence that causes
the different results.

elein

On Tue, Feb 17, 2004 at 10:53:17PM -0500, Tom Lane wrote:
> elein <elein(at)varlena(dot)com> writes:
> > Apparently the ::char is cast to varchar and then text?
>
> No, directly to text, because the || operator is defined as taking text
> inputs. But there's no practical difference between text and varchar on
> this point.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Smith 2004-02-18 20:15:43 Re: Inserting NULL into Integer column
Previous Message Bruce Momjian 2004-02-18 19:52:20 Re: [PATCHES] NO WAIT ...

Browse pgsql-sql by date

  From Date Subject
Next Message Jeremy Smith 2004-02-18 20:15:43 Re: Inserting NULL into Integer column
Previous Message scott.marlowe 2004-02-18 19:43:34 Re: Inserting NULL into Integer column