Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C035C632520 for ; Fri, 12 Jun 2009 09:35:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 38011-01 for ; Fri, 12 Jun 2009 09:35:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from titania.wxnz.net (titania.wxnz.net [58.28.4.13]) by mail.postgresql.org (Postfix) with ESMTP id F2DA3632465 for ; Fri, 12 Jun 2009 09:35:41 -0300 (ADT) Received: from gonzo (ip-118-90-143-186.xdsl.xnet.co.nz [118.90.143.186]) by titania.wxnz.net (Postfix) with ESMTP id 62ABF1DB8349 for ; Sat, 13 Jun 2009 00:35:38 +1200 (NZST) Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1MF5wm-0000sD-8t for pgsql-sql@postgresql.org; Sat, 13 Jun 2009 00:33:28 +1200 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: setting the where clause Date: 12 Jun 2009 12:33:28 GMT Organization: Dis (not Dat) Organisation Lines: 27 Message-ID: References: <200906100519.34171.jfabiani@yolo.com> NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reversiblemaps.ath.cx 1244810008 3359 127.0.0.1 (12 Jun 2009 12:33:28 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-2 (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200906/61 X-Sequence-Number: 32666 On 2009-06-10, johnf 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)