X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 51B8CD7080 for ; Tue, 11 Oct 2005 11:40:40 -0300 (ADT) 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 66552-02 for ; Tue, 11 Oct 2005 14:40:31 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id D0F83D708C for ; Tue, 11 Oct 2005 11:40:33 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 6697440DDC7; Tue, 11 Oct 2005 15:40:27 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 4DC7915EDA; Tue, 11 Oct 2005 15:39:25 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20356-08; Tue, 11 Oct 2005 15:39:21 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 7AEEB15ED5; Tue, 11 Oct 2005 15:39:21 +0100 (BST) Message-ID: <434BCE99.1040608@archonet.com> Date: Tue, 11 Oct 2005 15:39:21 +0100 From: Richard Huxton User-Agent: Thunderbird 1.4.1 (X11/20051006) MIME-Version: 1.0 To: mario.splivalo@mobart.hr Cc: pgsql-sql@postgresql.org Subject: Re: Returning NULL results? References: <1129040845.7911.9.camel@ekim> In-Reply-To: <1129040845.7911.9.camel@ekim> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.162 required=5 tests=[AWL=-0.095, FORGED_RCVD_HELO=0.05, UPPERCASE_25_50=0.207] X-Spam-Level: X-Archive-Number: 200510/92 X-Sequence-Number: 22945 Mario Splivalo wrote: > > Of course, if it returns no rows, I'm presented with an error, saying: > > ERROR: record "rec" has no field "_qv" > > This is logical. My question would be is there a way around this > withouth first doing SELECT COUNT(*) FROM tmbBids WHERE ..., and then if > COUNT(*) is zero THEN bidCount := NULL ELSE if COUNT(*) is not zero then > do SELECT from the begining? Could you check the FOUND variable? As in IF NOT FOUND THEN RETURN NULL -- Richard Huxton Archonet Ltd