From: | "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at> |
---|---|
To: | "Hannu Krosing" <hannu(at)tm(dot)ee>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Scott Royston" <scroyston(at)mac(dot)com>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: string cast/compare broken? |
Date: | 2002-07-12 07:35:26 |
Message-ID: | 46C15C39FEB2C44BA555E356FBCD6FA4961E1C@m0114.s-mxs.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> I guess the strangest part was that both a.foo = 'S' and b.foo = 'S' but
> not a.foo=b.foo; (a.foo is varchar(5) , b.foo is char(5) )
>
> I guess that tha 'S' that b.foo gets compared to is converted to 'S '
> before comparison but when comparing varchar(5) and char(5) they are
> both compared by converting them to varchar which keeps the trailing
> spaces from char(5).
Yes, I think this is inconvenient/unintuitive. If it is doable according to
standards, this should imho be fixed.
> If the conversion where varchar(5) --> char(5) then
> they would compare equal.
I am not sure, since, if the varchar stored 'S ' then the comparison to a char 'S'
should probably still fail, since those spaces in the varchar are significant.
Informix compares them equal, so I guess argumentation can be made in that direction
too (that currently evades my understanding of intuitive reasoning :-).
Andreas
From | Date | Subject | |
---|---|---|---|
Next Message | Florian Helmberger | 2002-07-12 08:38:50 | Re: [PATCHES] Changes in /contrib/fulltextindex |
Previous Message | Thomas Lockhart | 2002-07-12 05:34:27 | Re: I am being interviewed by OReilly |