CASE in where statement. BUG ??

From: Marek Lewczuk <newsy(at)lewczuk(dot)com>
To: Lista dyskusyjna pgsql-general <pgsql-general(at)postgresql(dot)org>, Lista dyskusyjna pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: CASE in where statement. BUG ??
Date: 2003-12-19 08:43:21
Message-ID: 3FE2BA29.2060906@lewczuk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

I belive that I have found a bug - or maybe it was done on purpose. Have
a look at this query:

SELECT integer_field FROM bugtable WHERE (CASE WHEN '' <> '' THEN
integer_field = '' ELSE integer_field = 0 END);
Result: ERROR: invalid input syntax for integer: ""

SELECT text_field FROM bugtable WHERE (CASE WHEN '' <> '' THEN
text_field = '' ELSE text_field = '1' END);
Result: 1 rows fetched (0,02 sec)

Where table structure is:

CREATE TABLE "public"."bugtable" (
"integer_field" INTEGER,
"text_field" TEXT
) WITH OIDS;

I belive that PG reaction should be the same as in the second query --
there shouldn't be any errors.

$ psql --version
psql (PostgreSQL) 7.4
contains support for command-line editing
Windows XP/Cygwin

If this is not a bug, please tell me what is wrong.

ML

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Litvinov 2003-12-19 08:55:32 Re: [GENERAL] CASE in where statement. BUG ??
Previous Message aarjan langereis 2003-12-19 08:39:03 Re: BUG #1015: Got a signal 11 while trying to create a temp table

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Litvinov 2003-12-19 08:55:32 Re: [GENERAL] CASE in where statement. BUG ??
Previous Message Felix Finch 2003-12-19 07:46:48 Tables referencing each other