From: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: setting the where clause
Date: 12 Jun 2009 12:33:28 GMT
Message-ID: <h0thuo$38v$1@reversiblemaps.ath.cx> (raw)
References: <200906100519.34171.jfabiani@yolo.com>
On 2009-06-10, johnf <jfabiani@yolo.com> wrote:
> Hi,
> I'm am programming in python using the Dabo modules. www.dabodev.com if your
> interested. Dabo is a framework that provides an easy way to build desktop
> app's. To clear a data entry form. I have been setting the where clause
> to "where 1=0". This of course retrieves 0 records and my form will display
> nothing. It has been suggested that it might be better to set the where
> clause to a primary key value that does not exist in the table "where PK
>= -9999999".
"where PK=NULL" is better as anything=NULL is never true. PK=-9999999
may be true sometimes.
As Tom says PK=-9999999 causes postgres to look for a record that
matches, PK=NULL doesn't cause needless search.
that said if -9999999 is outside of the valid range for PK then the
search will finish very quickly as at worst only a sigle btree page
will need to be loaded.
in order of preference.
no query at all
where FALSE
where PK=NULL
where PK=-9999999 (note that this one may not work)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasen@xnet.co.nz
Subject: Re: setting the where clause
In-Reply-To: <h0thuo$38v$1@reversiblemaps.ath.cx>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox