X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 72F1E3A41BE for ; Wed, 19 Jan 2005 13:20:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82785-10 for ; Wed, 19 Jan 2005 13:20:14 +0000 (GMT) Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id A307A3A4168 for ; Wed, 19 Jan 2005 13:20:15 +0000 (GMT) Received: (qmail invoked by alias); 19 Jan 2005 13:20:14 -0000 Received: from p5087E22C.dip0.t-ipconnect.de (EHLO hermes.hilbert.loc) (80.135.226.44) by mail.gmx.net (mp018) with SMTP; 19 Jan 2005 14:20:14 +0100 X-Authenticated: #1433807 Received: (from ncq@localhost) by hermes.hilbert.loc (8.11.6/8.11.6/SuSE Linux 0.5) id j0JDIlC03730 for pgsql-sql@postgresql.org; Wed, 19 Jan 2005 14:18:47 +0100 Date: Wed, 19 Jan 2005 14:18:47 +0100 From: Karsten Hilbert To: pgsql-sql@postgresql.org Subject: Re: Returning a bool on DELETE in a proc. Message-ID: <20050119141847.J732@hermes.hilbert.loc> References: <41EE4FB2.9080307@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41EE4FB2.9080307@archonet.com> User-Agent: Mutt/1.3.22.1i X-Y-GMX-Trusted: 0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/145 X-Sequence-Number: 19933 > >So what variable/function is the correct SQL-equivalent to ROW_COUNT and > >can it be used in the following statement ? > >like DELETE...; SELECT (ROW_COUNT<>0); to return a bool value? > > SQL doesn't support that (although I suppose it could be made to with > some pg_rows_affected() function). If someone could only post that pg_rows_affected() function - this would end all further requests for "row number in result set" inquiries with the simple advice "use pg_rows_affected() and join that with an integer table". I'd know a bunch of uses right off the top of my head. I suppose it ain't hard at all but my C skills are way to limited to try anything like that. My understanding, too, likely. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346