Re: How to check: is some key referenced from sometable

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: evl(at)my-mail(dot)com(dot)ua
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to check: is some key referenced from sometable
Date: 2003-08-09 15:08:09
Message-ID: 20030809150809.GA22927@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Aug 04, 2003 at 11:17:56 +0300,
evl(at)my-mail(dot)com(dot)ua wrote:
> Please help.
>
> Need a boolean function which returns true if given key in table is
> referensed from another table(s).

Use "exists" with a subselect. Something like:
select exists(select 1 from table where table.key = 'value');

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-08-09 15:16:20 Re: Error message with a SQL function
Previous Message Tom Lane 2003-08-09 14:34:07 Re: Comparing arrays