Re: PL/pgSQL PERFORM with CTE - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: PL/pgSQL PERFORM with CTE
Date
Msg-id 521D448B.80308@2ndQuadrant.com
Whole thread Raw
In response to Re: PL/pgSQL PERFORM with CTE  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: PL/pgSQL PERFORM with CTE  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On 08/28/2013 12:10 AM, Pavel Stehule wrote:
>
>
> so if I write on client side
>
> BEGIN;
>   SELECT 1,2;
>   SELECT 2;
>   SELECT 3,4;
> END;
>
> then I expect results
>
> 1,2
> 2
> 3,4
And you are perfectly ok to discard the results
Actually it would be much more helpful to have
"discard the results" syntax from client side, as
in this case they take up network resources.
>
> Procedure is some batch moved and wrapped on server side
>
> CREATE PROCEDURE foo()
> BEGIN
>   SELECT 1,2;
>   SELECT 2;
>   SELECT 3,4
> END;
>
> And is not strange expect a result
>
> CALL foo()
>
> 1,2
> 2
> 3,4
>
> Procedure is a script (batch) moved to server side for better
> performance and better reuse.
And you are perfectly ok to discard the results here as well

In a function I do expect the result from select but I also
expect that I can silently ignore the result.

> My proposal is consistent - no result goes to /dev/null without
> special mark. It is disabled (in function) or it goes to client (in
> procedures).
So you can ignore the result in a procedure (by just skipping / not
assigning it on client) but not in a function ?

Can you point out some other languages which *require* you
to store the result of a function call or have a special syntax/keyword
when you do not want to store it ?

Cheer









-- 
Hannu Krosing
PostgreSQL Consultant
Performance, Scalability and High Availability
2ndQuadrant Nordic OÜ




pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: PL/pgSQL PERFORM with CTE
Next
From: Sawada Masahiko
Date:
Subject: Re: Behaviour of take over the synchronous replication