Thread: 6.5.3 - backend closes if wrong parameters to NULLIF, CASE

6.5.3 - backend closes if wrong parameters to NULLIF, CASE

From
"Emils Klotins"
Date:
Continuing to try to work with the things.

I have a table "authors" with approx following fields:
( name text, id int4, birthdate date, ... , address_id int4 )

- when using a wrong CASE or NULLIF in INSERT/UPDATE 
statement on birthdate, it seems that it corrupts the 
address_id field.

Ie. If I do a thing like UPDATE authors set 
birthdate=NULLIF(date '12-12-1999', date '') ...

the backend will die and whenever afterwards I try to SELECT 
the address_id field from the updated row, it would die again.

If I do a SELECT NULLIF(date '12-12-1999', date '') it will 
correctly complain that '' is a wrong date value.

Seems also that when I try to UPDATE/INSERT using a CASE 
stmt it would die too, again corrupting the address_id field.




Re: [SQL] 6.5.3 - backend closes if wrong parameters to NULLIF, CASE

From
Tom Lane
Date:
"Emils Klotins" <emils@mail.usis.bkc.lv> writes:
> Ie. If I do a thing like UPDATE authors set 
> birthdate=NULLIF(date '12-12-1999', date '') ...
> the backend will die and whenever afterwards I try to SELECT 
> the address_id field from the updated row, it would die again.

I get "Bad date external representation ''" from either 6.5.3
or current sources.

Are you sure you're running 6.5.3, and not some older version?
I fixed a lot of bugs involving CASE around 6.5 ...

If it's not that, then there must be some other aspect of your
example that's critical but you haven't shown us.  Please file
a formal bug report giving a complete SQL script that reproduces
the bug.
        regards, tom lane