pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14059: BUG? function in select clause called more times when use offset
3+ messages / 3 participants
[nested] [flat]
* BUG #14059: BUG? function in select clause called more times when use offset
@ 2016-04-02 11:40 digoal@126.com
2016-04-02 14:49 ` Re: BUG #14059: BUG? function in select clause called more times when use offset Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: digoal@126.com @ 2016-04-02 11:40 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 14059
Logged by: digoal
Email address: digoal@126.com
PostgreSQL version: 9.5.2
Operating system: CentOS 6.x x64
Description:
postgres=# create or replace function f() returns void as $$
declare
begin
raise notice 'called';
end;
$$ language plpgsql strict volatile;
CREATE FUNCTION
postgres=# select f(),* from ( values(1),(2),(3),(4),(5),(6) ) t(id) offset
3 limit 2;
NOTICE: called
NOTICE: called
NOTICE: called
NOTICE: called
NOTICE: called
f | id
---+----
| 4
| 5
(2 rows)
offset skip 3 tuple, but function f() called with 5 times, can we tuning
this .
or this is a bug?
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #14059: BUG? function in select clause called more times when use offset
2016-04-02 11:40 BUG #14059: BUG? function in select clause called more times when use offset digoal@126.com
@ 2016-04-02 14:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-04-02 16:13 ` Re: BUG #14059: BUG? function in select clause called more times when use offset 德哥 <digoal@126.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2016-04-02 14:49 UTC (permalink / raw)
To: digoal@126.com; +Cc: pgsql-bugs
digoal@126.com writes:
> postgres=# create or replace function f() returns void as $$
> declare
> begin
> raise notice 'called';
> end;
> $$ language plpgsql strict volatile;
> CREATE FUNCTION
> postgres=# select f(),* from ( values(1),(2),(3),(4),(5),(6) ) t(id) offset
> 3 limit 2;
> NOTICE: called
> NOTICE: called
> NOTICE: called
> NOTICE: called
> NOTICE: called
> f | id
> ---+----
> | 4
> | 5
> (2 rows)
> offset skip 3 tuple, but function f() called with 5 times, can we tuning
> this .
> or this is a bug?
No, it's not a bug. OFFSET only results in the skipped tuples not being
delivered to the client; it does not cause them not to be computed.
You could probably do something with a two-level select with the OFFSET
in the sub-select and the volatile function in the top level.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #14059: BUG? function in select clause called more times when use offset
2016-04-02 11:40 BUG #14059: BUG? function in select clause called more times when use offset digoal@126.com
2016-04-02 14:49 ` Re: BUG #14059: BUG? function in select clause called more times when use offset Tom Lane <tgl@sss.pgh.pa.us>
@ 2016-04-02 16:13 ` 德哥 <digoal@126.com>
0 siblings, 0 replies; 3+ messages in thread
From: 德哥 @ 2016-04-02 16:13 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
Thanks
--
公益是一辈子的事,I'm Digoal,Just Do It.
At 2016-04-02 22:49:26, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
>digoal@126.com writes:
>> postgres=# create or replace function f() returns void as $$
>> declare
>> begin
>> raise notice 'called';
>> end;
>> $$ language plpgsql strict volatile;
>> CREATE FUNCTION
>
>> postgres=# select f(),* from ( values(1),(2),(3),(4),(5),(6) ) t(id) offset
>> 3 limit 2;
>> NOTICE: called
>> NOTICE: called
>> NOTICE: called
>> NOTICE: called
>> NOTICE: called
>> f | id
>> ---+----
>> | 4
>> | 5
>> (2 rows)
>
>> offset skip 3 tuple, but function f() called with 5 times, can we tuning
>> this .
>> or this is a bug?
>
>No, it's not a bug. OFFSET only results in the skipped tuples not being
>delivered to the client; it does not cause them not to be computed.
>
>You could probably do something with a two-level select with the OFFSET
>in the sub-select and the volatile function in the top level.
>
> regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2016-04-02 16:13 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-04-02 11:40 BUG #14059: BUG? function in select clause called more times when use offset digoal@126.com
2016-04-02 14:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-04-02 16:13 ` 德哥 <digoal@126.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox