Re: I must be blind... - Mailing list pgsql-general

From Nigel J. Andrews
Subject Re: I must be blind...
Date
Msg-id Pine.LNX.4.21.0206142315460.4131-100000@ponder.fairway2k.co.uk
Whole thread Raw
In response to Re: I must be blind...  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: I must be blind...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Fri, 14 Jun 2002, Tom Lane wrote:

> Joe Conway <mail@joeconway.com> writes:
> > I don't think you can use PERFORM like that. Try:
>
> Actually I believe he can; after looking at the manual I realized that
> the problem is that PERFORM is syntactically a substitute for SELECT.
> In other words he needed to write
>
>     PERFORM 1 FROM orders ...
> not
>     PERFORM SELECT 1 FROM orders ...

Yes, indeed if one reads what is there rather than reading things that aren't
it does say that PERFORM substitutes for SELECT syntactically.

However, because PERFORM discards the results of a query it is only useful for
side effects of the query. My usage of it was wrong since I wasn't using it for
side effects merely for determining the existance of a result without having to
store that result since it wasn't required. Therefore, with the correct syntax
of PERFORM <query> my function doesn't generate an 'unprogrammed' error but the
test of FOUND always fails, i.e. result is NOT FOUND. Therefore SELECT INTO
dummy ... is still the correct thing for me to be doing.

I just thought I'd clear that up in case anyone was wondering, and yes, I have
tested it.


--
Nigel J. Andrews
Director

---
Logictree Systems Limited
Computer Consultants


pgsql-general by date:

Previous
From: "Nigel J. Andrews"
Date:
Subject: Re: I must be blind...
Next
From: Tom Lane
Date:
Subject: Re: I must be blind...