pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: CG <cgg007@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: empty set
Date: Fri, 9 Jun 2006 02:33:56 -0500
Message-ID: <20060609073356.GA522@wolff.to> (raw)
In-Reply-To: <20060608214012.96518.qmail@web37907.mail.mud.yahoo.com>
References: <20060608214012.96518.qmail@web37907.mail.mud.yahoo.com>

On Thu, Jun 08, 2006 at 14:40:12 -0700,
  CG <cgg007@yahoo.com> 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)




view thread (5+ messages)  latest in thread

Message-ID: <20060609073356.GA522@wolff.to>
Permalink:  ../20060609073356.GA522@wolff.to/
Also on:    postgresql.org/message-id/20060609073356.GA522@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, cgg007@yahoo.com
  Subject: Re: empty set
  In-Reply-To: <20060609073356.GA522@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox