BUG #1591: BETWEEN NULL AND NULL causes crash - Mailing list pgsql-bugs

From Michael Williamson
Subject BUG #1591: BETWEEN NULL AND NULL causes crash
Date
Msg-id 20050407193627.9B2D1F0F75@svr2.postgresql.org
Whole thread Raw
Responses Re: BUG #1591: BETWEEN NULL AND NULL causes crash
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1591
Logged by:          Michael Williamson
Email address:      michael.williamson@caseware.com
PostgreSQL version: 8.0.1
Operating system:   Windows 2000
Description:        BETWEEN NULL AND NULL causes crash
Details:

Hello,

I have the following query:

SELECT * FROM Entities
WHERE NULL IS NULL OR (EntityNo BETWEEN NULL AND COALESCE(NULL,NULL))

This causes one of two results: postmaster crashes or goes into an infinite
loop.  The reason I have such a strange query is because values are filled
in from a dialog.  It looks more like:

SELECT * FROM Entities
WHERE %p1 IS NULL OR (EntityNo BETWEEN %p1 AND COALESCE(%p2,%p1))

This query executes ok on other dbs (mssql, mysql) and returns the correct
result (all records).  I can fix it for postgre by doing:

SELECT * FROM Entities
WHERE NULL IS NULL OR (EntityNo BETWEEN NULL AND COALESCE(NULL,NULL,''))

But none the less nothing should make it loop infinitely or crash.

Thanks

pgsql-bugs by date:

Previous
From: "Byron Zambrano"
Date:
Subject: BUG #1579: DO NOT CONNECT
Next
From: "Gabor Berenyi"
Date:
Subject: BUG #1592: "with hold" cursor problem