Skip site navigation (1) Skip section navigation (2)

BUG #1591: BETWEEN NULL AND NULL causes crash

From: "Michael Williamson" <michael(dot)williamson(at)caseware(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1591: BETWEEN NULL AND NULL causes crash
Date: 2005-04-07 19:36:27
Message-ID: 20050407193627.9B2D1F0F75@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1591
Logged by:          Michael Williamson
Email address:      michael(dot)williamson(at)caseware(dot)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

Responses

pgsql-bugs by date

Next:From: Enrico WeigeltDate: 2005-04-08 01:05:32
Subject: Re: float conversion / presentation problem ?
Previous:From: David FetterDate: 2005-04-07 16:10:10
Subject: Re: float conversion / presentation problem ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group