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 50FBE9FA621 for ; Fri, 9 Jun 2006 10:00:47 -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 30203-05 for ; Fri, 9 Jun 2006 10:00:39 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web37915.mail.mud.yahoo.com (web37915.mail.mud.yahoo.com [209.191.124.110]) by postgresql.org (Postfix) with SMTP id 1CA859FA61D for ; Fri, 9 Jun 2006 10:00:38 -0300 (ADT) Received: (qmail 32157 invoked by uid 60001); 9 Jun 2006 13:00:37 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Bqb3wG7Qqv3W/T6ZuiKNe3fX2B/1kqV84/7X7QsUiNoyPcgHD7s2NrSDmOPxyvoNJC1M2uufSm228u9oE1nOhrPy/yu8wjYtOni7FZvYY/Ql+2EBw009MlRzmbX4zWFqNPUYnV4aoMc6JmiTH3Rb4yMrmdfj/HAWHaZchVvpfWM= ; Message-ID: <20060609130037.32155.qmail@web37915.mail.mud.yahoo.com> Received: from [216.173.173.66] by web37915.mail.mud.yahoo.com via HTTP; Fri, 09 Jun 2006 06:00:37 PDT Date: Fri, 9 Jun 2006 06:00:37 -0700 (PDT) From: CG Reply-To: cgg007@yahoo.com Subject: Re: empty set To: Bruno Wolff III Cc: pgsql-sql@postgresql.org In-Reply-To: <20060609073356.GA522@wolff.to> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/108 X-Sequence-Number: 25344 "select 1 where false" does indeed indicate an empty set. I was hoping for something more elegant, but I'll take what I can get. :) --- Bruno Wolff III wrote: > On Thu, Jun 08, 2006 at 14:40:12 -0700, > 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? > > Something like the following suggests you can put a subquery there that > returns > 0 rows. I don't think that wil work for prepared queries though; so it may > not > help you. > > bruno=> select * from test where test in (select 1 where false); > test > ------ > (0 rows) > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com