Re: BUG #6483: Rows being evaluated, although being outside the LIMIT / OFFSET boundaries - Mailing list pgsql-bugs

From Pavel Stehule
Subject Re: BUG #6483: Rows being evaluated, although being outside the LIMIT / OFFSET boundaries
Date
Msg-id CAFj8pRBFVec_RuoQ-4CrYPjcq6zpdB+HpkFCm+9-HhN3j-wc2A@mail.gmail.com
Whole thread Raw
In response to BUG #6483: Rows being evaluated, although being outside the LIMIT / OFFSET boundaries  (kouber@saparev.com)
List pgsql-bugs
Hello

this is not bug

"OFFSET" doesn't mean go to line n - it means - first n lines don't
send to client.

Regards

Pavel Stehule

2012/2/22  <kouber@saparev.com>:
> The following bug has been logged on the website:
>
> Bug reference: =C2=A0 =C2=A0 =C2=A06483
> Logged by: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Kouber Saparev
> Email address: =C2=A0 =C2=A0 =C2=A0kouber@saparev.com
> PostgreSQL version: 9.1.2
> Operating system: =C2=A0 Debian
> Description:
>
> The rows of a SELECT statement are being evaluated, even when not shown in
> the final result, when using an OFFSET > 0. Although I know that LIMIT is
> imposed just before flushing the result set to the client, this behaviour
> seems quite confusing, especially when using DML statements in the field
> list of the SELECT itself.
>
> CREATE TABLE xxx (id INT);
>
> CREATE FUNCTION f(xxx) RETURNS VOID AS $$
> BEGIN
> =C2=A0-- imagine some DML statements here --
>
> =C2=A0RAISE NOTICE '%', $1.id;
> END;
> $$ LANGUAGE PLPGSQL;
>
> INSERT INTO xxx VALUES (1), (2), (3), (4), (5);
>
>
> -- shows a notice for 1 and 2
> SELECT x.id, f(x) FROM xxx as x LIMIT 2;
>
>
> -- shows a notice for 1, 2, 3 and 4
> SELECT x.id, f(x) FROM xxx as x LIMIT 2 OFFSET 2;
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: kouber@saparev.com
Date:
Subject: BUG #6483: Rows being evaluated, although being outside the LIMIT / OFFSET boundaries
Next
From: dzolotarevskiy@gmail.com
Date:
Subject: BUG #6482: Service terminates executing "With ... as ... UPDATE" query