Re: [GENERAL] CASE in where statement. BUG ??

From: Alexander Litvinov <lan(at)ac-sw(dot)com>
To: Marek Lewczuk <newsy(at)lewczuk(dot)com>, Lista dyskusyjna pgsql-general <pgsql-general(at)postgresql(dot)org>, Lista dyskusyjna pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: [GENERAL] CASE in where statement. BUG ??
Date: 2003-12-19 08:55:32
Message-ID: 200312191455.32740.lan@ac-sw.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

This is normaol behavior.

> 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: ""

Here CASE have int type and you are trying to cast '' to int. Error.

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

Here CASE have text type. Everything is fine.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Marek Lewczuk 2003-12-19 09:02:39 Re: [GENERAL] CASE in where statement. BUG ??
Previous Message Marek Lewczuk 2003-12-19 08:43:21 CASE in where statement. BUG ??

Browse pgsql-general by date

  From Date Subject
Next Message Marek Lewczuk 2003-12-19 09:02:39 Re: [GENERAL] CASE in where statement. BUG ??
Previous Message Marek Lewczuk 2003-12-19 08:43:21 CASE in where statement. BUG ??