Re: setting the where clause

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: setting the where clause
Дата
Msg-id 347.1244643554@sss.pgh.pa.us
обсуждение исходный текст
Ответ на setting the where clause  (johnf <jfabiani@yolo.com>)
Ответы Re: setting the where clause  (Rob Sargent <robjsargent@gmail.com>)
Список pgsql-sql
johnf <jfabiani@yolo.com> writes:
> 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".   

Whoever said that doesn't know what they're talking about.  It's not
faster (because it forces an actual index probe to happen) and it's not
safer (what if one day that PK value exists?).

I'd personally go with "where false"; why not say what you mean rather
than forcing humans and computers to deduce that the condition is
constant false?
        regards, tom lane


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

Предыдущее
От: johnf
Дата:
Сообщение: setting the where clause
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: setting the where clause