Re: setting the where clause

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: setting the where clause
Date: 2009-06-10 15:13:06
Message-ID: 4A2FCD82.7000206@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Tom Lane wrote:
> johnf <jfabiani(at)yolo(dot)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
>
>

Of course you would do the world a favour if you wrote a client-side
clear-the-screen routine that didn't pester the net and the server
un-necessarily.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bryce Nesbitt 2009-06-11 06:20:41 Re: Avoiding "will create implicit index" NOTICE
Previous Message Tom Lane 2009-06-10 14:19:14 Re: setting the where clause