Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id E1413633B88 for ; Wed, 10 Jun 2009 11:19:17 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 89156-07 for ; Wed, 10 Jun 2009 11:19:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id BB353632341 for ; Wed, 10 Jun 2009 11:19:16 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n5AEJEw2000348; Wed, 10 Jun 2009 10:19:15 -0400 (EDT) To: johnf cc: pgsql-sql@postgresql.org Subject: Re: setting the where clause In-reply-to: <200906100519.34171.jfabiani@yolo.com> References: <200906100519.34171.jfabiani@yolo.com> Comments: In-reply-to johnf message dated "Wed, 10 Jun 2009 05:19:34 -0700" Date: Wed, 10 Jun 2009 10:19:14 -0400 Message-ID: <347.1244643554@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200906/46 X-Sequence-Number: 32651 johnf 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