Re: string cast/compare broken?

From: "John Liu" <johnl(at)synthesys(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: string cast/compare broken?
Date: 2002-07-12 14:24:03
Message-ID: NDBBKKKHILOHGHNKGOCEGELCDMAA.johnl@synthesys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)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(at)postgresql(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2002-07-12 14:25:00 Re: Can I have multiple cursors open ...
Previous Message Stephan Szabo 2002-07-12 14:16:58 Re: string cast/compare broken?