From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | William ZHANG <uniware(at)zedware(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [BUGS] 7.4: CHAR padding inconsistency |
Date: | 2003-11-30 04:44:45 |
Message-ID: | 200311300444.hAU4ijU28084@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Added to TODO:
Make LENGTH() of CHAR() not count trailing spaces
---------------------------------------------------------------------------
Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Well, that certainly is interesting. Oracle and MS-SQL preserve the
> > trailing space when concatenating. Does anyone remember the logic for
> > trimming space with ||?
>
> "trimming space with ||" is a completely inaccurate description of
> what's happening.
>
> 7.4 trims spaces from char(n) data when converting it to text (or
> varchar). Since we don't have a bpchar version of ||, only a text
> version, the implicitly invoked conversion is what's making the
> difference.
>
> AFAICS the Oracle and SQL Server behaviors are at least as inconsistent
> as our own. If trailing spaces are significant during concatenation,
> why aren't they significant to LENGTH()? I can't see a justification
> in the SQL spec for handling one case differently from the other.
>
> Actually the SQL spec is pretty inconsistent itself. It's clear that
> trailing spaces are insignificant in comparisons, if you are using a
> PAD SPACE collation which I think is the implication of CHAR(n), but
> I don't see anything that says that they are insignificant for other
> purposes such as LENGTH() and concatenation.
>
> I'd agree with changing bpcharlen() to not count trailing spaces,
> I think. That would be consistent with ignoring them in other contexts.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2003-11-30 05:02:37 | Re: PATCH: Uninitialized variable usage in contrib/pg_autovacuum |
Previous Message | Bruce Momjian | 2003-11-30 04:33:38 | Re: [BUGS] (Modified) Patch request for PostgreSQL 7.4 for HP-UX IA-64 |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2003-11-30 05:07:34 | Re: initdb mkdir_p() doesn't work |
Previous Message | Christopher Browne | 2003-11-30 04:11:16 | Re: *sigh* |