On Tue, May 19, 2009 at 7:00 PM, Tom Lane <[email protected]> wrote:
> Merlin Moncure <[email protected]> writes:
>> On Mon, May 18, 2009 at 3:13 PM, Joshua Berry <[email protected]> wrote:
>>> Is there an easy and efficient way to return a boolean false for a query
>>> that returns no result, and true for one that does return a result?
>
>> Probably the best general approach is to:
>
>> select count(*) = 1 from
>> (
>>   <query> limit 1
>> )q;
>
> Seems like EXISTS() is much more straightforward ...

yes...I didn't notice david's response upthread.  that is indeed very elegant.

merlin

-- 
Sent via pgsql-general mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to