dbTalk Databases Forums  

Re: [BUGS] Problem cocatenating String (||)

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [BUGS] Problem cocatenating String (||) in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Problem cocatenating String (||) - 09-14-2004 , 12:33 AM






"Thomas Niemeier" <thomas.niemeier (AT) case-bielefeld (DOT) de> writes:
Quote:
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

---------------------------(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)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.