X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9662DD1C9BA for ; Sat, 9 Aug 2003 15:03:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 78987-01 for ; Sat, 9 Aug 2003 12:01:29 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id ACD37D1C9CB for ; Sat, 9 Aug 2003 12:02:49 -0300 (ADT) Received: (qmail 22968 invoked by uid 500); 9 Aug 2003 15:08:09 -0000 Date: Sat, 9 Aug 2003 10:08:09 -0500 From: Bruno Wolff III To: evl@my-mail.com.ua Cc: pgsql-sql@postgresql.org Subject: Re: How to check: is some key referenced from sometable Message-ID: <20030809150809.GA22927@wolff.to> Mail-Followup-To: evl@my-mail.com.ua, pgsql-sql@postgresql.org References: <3159.195.5.48.107.1059985076.squirrel@my-mail.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3159.195.5.48.107.1059985076.squirrel@my-mail.com.ua> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/85 X-Sequence-Number: 14701 On Mon, Aug 04, 2003 at 11:17:56 +0300, evl@my-mail.com.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');