Re: setting the where clause

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: setting the where clause
Дата
Msg-id h0thuo$38v$1@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на setting the where clause  (johnf <jfabiani@yolo.com>)
Список pgsql-sql
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) 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: polymorphic function in 7.4 vs. 8.3
Следующее
От: Mario Splivalo
Дата:
Сообщение: Find periods for a given... action set?