Strange behaviour ? - Mailing list pgsql-general

From Daniele Orlandi
Subject Strange behaviour ?
Date
Msg-id 35C0956D.1A05A82@orlandi.com
Whole thread Raw
Responses Re: [GENERAL] Strange behaviour ?  (James Boorn <boorn@acsys.com>)
List pgsql-general
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@orlandi.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@orlandi.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@orlandi.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) -

pgsql-general by date:

Previous
From: Maarten Boekhold
Date:
Subject: User authentication blues
Next
From: James Boorn
Date:
Subject: Re: [GENERAL] Strange behaviour ?