BUG #1905: When a column with the chkpass datatype is used in a where clause it returns invalid results - Mailing list pgsql-bugs

From Trevor Tingey
Subject BUG #1905: When a column with the chkpass datatype is used in a where clause it returns invalid results
Date
Msg-id 20050923044216.C50F6F0D79@svr2.postgresql.org
Whole thread Raw
Responses Re: BUG #1905: When a column with the chkpass datatype is used in a where clause it returns invalid results  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1905
Logged by:          Trevor Tingey
Email address:      ttingey@gmail.com
PostgreSQL version: 8.1 beta 2
Operating system:   Windows XP Home Edition SP 2
Description:        When a column with the chkpass datatype is used in a
where clause it returns invalid results
Details:

My schema is as follows:

CREATE TABLE account
(
  "AccountId" int4 NOT NULL DEFAULT
nextval('public."account_AccountId_seq"'::text),
  "AccountName" varchar(255) NOT NULL,
  "Password" chkpass,
  "Description" varchar(255),
  CONSTRAINT account_pkey PRIMARY KEY ("AccountId"),
  CONSTRAINT "account_Username_key" UNIQUE ("AccountName")
)
WITHOUT OIDS;


I ran the following queries and got unexpected results:

UPDATE Account
SET "Password" = 'password1'
WHERE "AccountName" = 'Trevor'

SELECT *
FROM Account
WHERE "AccountName" = 'Trevor'
AND "Password" = 'password2'

(I ran them individually)

The Select query unexpectedly returned a result. I also  added another digit
on the end of 'password2' i.e. 'password21' and that returned the same
result. I also changed it to 'password3' etc. and got the same result and
the same with 'password'. When I changed it to 'passwor1' it did not return
a result.

Running SELECT * FROM Account returns two rows, one with the accountname of
'administrator' and the other 'Trevor'.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1883: Renaming a schema leaves inconsistent sequence
Next
From: Tom Lane
Date:
Subject: Re: BUG #1905: When a column with the chkpass datatype is used in a where clause it returns invalid results