X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 74D4D9FA5D8 for ; Fri, 9 Jun 2006 01:47:26 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 10956-08 for ; Fri, 9 Jun 2006 01:47:18 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by postgresql.org (Postfix) with ESMTP id B4AC29FA5D2 for ; Fri, 9 Jun 2006 01:47:17 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id m3so1052916uge for ; Thu, 08 Jun 2006 21:47:16 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=KawERQXtX7547hbzlt1VzIKS77agFcy2uztgu3LVKB9SuYgcyd3bJb7HzjGBCyjUHhsY6qgN+oxLVoki0i3ZbCW/k6gDQLCmkzbWUnI69s8D8q+Cf0q4+DXSyScaGrTi9yALViKf+WF8zCs4qP5SnuPR17CcHYaBFHDIRauwJQk= Received: by 10.67.103.7 with SMTP id f7mr2159037ugm; Thu, 08 Jun 2006 21:47:16 -0700 (PDT) Received: by 10.67.20.12 with HTTP; Thu, 8 Jun 2006 21:47:16 -0700 (PDT) Message-ID: Date: Thu, 8 Jun 2006 23:47:16 -0500 From: "Aaron Bono" To: pgsql-sql@postgresql.org Subject: Re: empty set In-Reply-To: <1149802941.25526.279.camel@state.g2switchworks.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15968_3010551.1149828436329" References: <20060608214012.96518.qmail@web37907.mail.mud.yahoo.com> <1149802941.25526.279.camel@state.g2switchworks.com> X-Google-Sender-Auth: 3cf6e8dacf77c788 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/106 X-Sequence-Number: 25342 ------=_Part_15968_3010551.1149828436329 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline That will work if foo is never NULL. If foo takes on a NULL value you will get those records where it is NULL. Is there a reason you cannot do an if/else statement on the list size? That is what I do on my queries. -Aaron On 6/8/06, Scott Marlowe wrote: > > On Thu, 2006-06-08 at 16:40, CG wrote: > > PostgreSQL 8.1 > > > > I've been trying to write a SQL prepare routine. One of the challenging > > elements I'm running into is an empty set ... > > > > "select foo from bar where foo in ? ;" > > > > What if "?" is an set with zero elements? What is the proper value to > use to > > replace "?" indicating an empty set? > > NULL? > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > ------=_Part_15968_3010551.1149828436329 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline That will work if foo is never NULL.  If foo takes on a NULL value you will get those records where it is NULL.

Is there a reason you cannot do an if/else statement on the list size?  That is what I do on my queries.

-Aaron

On 6/8/06, Scott Marlowe <smarlowe@g2switchworks.com> wrote:
On Thu, 2006-06-08 at 16:40, CG wrote:
> PostgreSQL 8.1
>
> I've been trying to write a SQL prepare routine. One of the challenging
> elements I'm running into is an empty set ...
>
> "select foo from bar where foo in ? ;"
>
> What if "?" is an set with zero elements? What is the proper value to use to
> replace "?" indicating an empty set?

NULL?

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


------=_Part_15968_3010551.1149828436329--