Re: empty set

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: CG <cgg007(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: empty set
Date: 2006-06-09 07:33:56
Message-ID: 20060609073356.GA522@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message CG 2006-06-09 13:00:37 Re: empty set
Previous Message Aaron Bono 2006-06-09 04:47:16 Re: empty set