| From: | James Boorn <boorn(at)acsys(dot)com> | 
|---|---|
| To: | Daniele Orlandi <daniele(at)orlandi(dot)com> | 
| Cc: | pgsql-general(at)postgreSQL(dot)org | 
| Subject: | Re: [GENERAL] Strange behaviour ? | 
| Date: | 1998-07-30 16:02:10 | 
| Message-ID: | Pine.LNX.3.96.980730100107.5415A-100000@csepp009.acsys.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
look up the differences between varchar and char data types.
On Thu, 30 Jul 1998, Daniele Orlandi wrote:
> tacacs=> CREATE TABLE bugdb
> tacacs-> (
> tacacs->  id       int4 default nextval('bugdb_id_seq') primary key,
> tacacs->  email    varchar(50) NOT NULL,
> tacacs->  sdescr   varchar(80),
> tacacs->  ldescr   text,
> tacacs->  version  char(16),
> tacacs->  status   char(16),
> tacacs->  comments text,
> tacacs->  ctime    datetime,
> tacacs->  mtime    datetime
> tacacs-> );
> NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index bugdb_pkey for
> table bugdb
> CREATE
> 
> tacacs=> insert into bugdb values ( 1,'daniele(at)orlandi(dot)com','Test
> BUG','TestText','3.0.0','open' );
> INSERT 2725845 1
> 
> tacacs=> SELECT id,status,version,email,sdescr FROM bugdb WHERE status = 'open'
> ORDER BY id;
> id|status          |         version|email              |sdescr
> --+----------------+----------------+-------------------+--------
>  1|open            |3.0.0           |daniele(at)orlandi(dot)com|Test BUG
> (1 row)
> 
> tacacs=> SELECT id,status,version,email,sdescr FROM bugdb WHERE lower(status) =
> 'open' ORDER BY id;
> id|status|version|email|sdescr
> --+------+-------+-----+------
> (0 rows)
> 
> tacacs=> SELECT id,status,version,email,sdescr FROM bugdb WHERE lower(status) =
> 'open            ' ORDER BY id;
> id|status          |         version|email              |sdescr
> --+----------------+----------------+-------------------+--------
>  1|open            |3.0.0           |daniele(at)orlandi(dot)com|Test BUG
> (1 row)
> 
> As you may see, LOWER(status) matches only 'open            ', not 'open'.
> 
> Is it the correct behaviour of LOWER() when applied to fixed size fields ?
> 
> Regards.
> 
> -- 
>  Daniele
> 
> -------------------------------------------------------------------------------
> "I'd crawl over an acre of 'Visual This++' and 'Integrated Development
> That' to get to gcc, Emacs, and gdb.  Thank you."
> (By Vance Petree, Virginia Power)
> -------------------------------------------------------------------------------
>  Se telecom italia aggiungesse uno scatto al giorno ad ogni abbonato, dal
>  primo Gennaio avrebbe rubato 668.954.000.000 Lire.
> -------------------------------------------------------------------------------
>  Daniele Orlandi - Utility Line Italia - http://www.orlandi.com
>  Via Mezzera 29/A - 20030 - Seveso (MI) -
> 
/************************************************************
James Boorn
boorn(at)acsys(dot)com
---------------------------------------------------------
"All right, brain, I don't like you and you don't like me -
    so let's just do this and I'll get back to killing you with beer." 
-- Homer Simpson 
************************************************************/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jeffrey Napolitano | 1998-07-30 16:10:59 | Re: [GENERAL] User authentication blues | 
| Previous Message | Daniele Orlandi | 1998-07-30 15:46:53 | Strange behaviour ? |