Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 0C2892E3977 for ; Wed, 16 Jan 2008 19:28:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 77300-02-7 for ; Wed, 16 Jan 2008 19:28:37 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 63B512E3A35 for ; Wed, 16 Jan 2008 19:28:41 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id m0GNSeYg029648; Wed, 16 Jan 2008 18:28:40 -0500 (EST) To: Kevin Jenkins cc: pgsql-sql@postgresql.org Subject: Re: How to test/read a stored procedure that returns a boolean? In-reply-to: <478E901D.7060701@rakkar.org> References: <478E901D.7060701@rakkar.org> Comments: In-reply-to Kevin Jenkins message dated "Wed, 16 Jan 2008 15:15:41 -0800" Date: Wed, 16 Jan 2008 18:28:40 -0500 Message-ID: <29647.1200526120@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/146 X-Sequence-Number: 29999 Kevin Jenkins writes: > create or replace function IsUsedHandle(h text) returns boolean as $$ > declare > begin > select COUNT(*) as num_matches from handles where handles.handle = h; > return num_matches > 0; > end; > $$ LANGUAGE plpgsql; I think you've confused AS with INTO. You forgot to declare num_matches as a local variable, too. regards, tom lane