From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Thomas Niemeier" <thomas(dot)niemeier(at)case-bielefeld(dot)de> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Problem cocatenating String (||) |
Date: | 2004-09-14 05:32:33 |
Message-ID: | 2750.1095139953@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"Thomas Niemeier" <thomas(dot)niemeier(at)case-bielefeld(dot)de> writes:
> I've got a problem concatenating two fields (char(10) not null) in a select statement. Let's say the first field pname has the value
> 'USER ' and the second field pfirst the value 'JOE '. Then a "select pname||pfirst from table" would return the value 'USERJOE', trimming all spaces in the fields. This behaviour seems to be new in Release 7.4.5. Release 7.3.2 returns 'USER JOE', which makes more sense to me.
The general feeling around here is that if you consider trailing spaces
to be significant, you ought to be storing your data as varchar not
char. The SQL spec is perfectly clear that trailing spaces in char(n)
are not significant for comparison purposes. It's a bit vague about how
to handle them otherwise, but we've found that supposing them to be
significant for some operations but not others leads to all sorts of
inconsistencies.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Mads Peter Henderson | 2004-09-14 07:01:05 | Bug in boolean columns on win2k |
Previous Message | PostgreSQL Bugs List | 2004-09-13 23:57:07 | BUG #1252: Optimization of SELECT for NOT NULL case |