Re: string cast/compare broken? - Mailing list pgsql-hackers

From John Liu
Subject Re: string cast/compare broken?
Date
Msg-id NDBBKKKHILOHGHNKGOCEGELCDMAA.johnl@synthesys.com
Whole thread Raw
In response to Re: string cast/compare broken?  ("Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>)
List pgsql-hackers
There is no comparison of varchar to char in Oracle too.
Scott provided cast cases are some unique features in psql, 
each database MAY handle those casting differently.

In good design/application, char should be replaced by
varchar type unless you know the exact bytes. It would be
not bad idea to get rid of char gradually in the future
to avoid such inconsistency 
between databases, that's just my view.

johnl

> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org]On Behalf Of Zeugswetter
> Andreas SB SD
> Sent: Friday, July 12, 2002 8:49 AM
> To: Tom Lane
> Cc: Hannu Krosing; Scott Royston; pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] string cast/compare broken? 
> 
> 
> 
> > Has anyone studied how other DBMSs handle CHAR vs VARCHAR?  Judging
> > from the number of questions we get on this point, I have to wonder
> > if we are not out of step with the way other systems do it.
> 
> Well, I already gave the Informix example, that compares them as equal.
> (they obviously coerce varchar to char)
> 
> In nearly all cases I have seen so far the different handling of trailing
> blanks is not wanted. In most of these varchar is simply used 
> instead of char to 
> save disk space.
> 
> In Informix ESQL/C there is a host variable type CSTRINGTYPE that 
> automatically 
> rtrims columns of char type upon select.
> 
> Imho the advantages of an automatic coercion would outweigh the 
> few corner cases
> where the behavior would not be intuitive to everybody.
> 
> Andreas
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


pgsql-hackers by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: string cast/compare broken?
Next
From: Thomas Lockhart
Date:
Subject: Re: Can I have multiple cursors open ...