Re: Fix for FETCH FIRST syntax problems

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: Fix for FETCH FIRST syntax problems
Date: 2018-05-20 03:25:33
Message-ID: 87tvr32gvz.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Updated patch.

This one explicitly accepts +/- ICONST/FCONST in addition to c_expr for
both offset and limit, removing the inconsistencies mentioned
previously.

I changed the wording of the docs part a bit; does that look better? or
worse?

Old behavior:
select 1 offset +1 rows; -- ERROR: syntax error at or near "rows"
select 1 fetch first +1 rows only; -- works
select 1 offset -1 rows; -- ERROR: syntax error at or near "rows"
select 1 fetch first -1 rows only; -- ERROR: LIMIT must not be negative

New behavior:
select 1 offset +1 rows; -- works
select 1 fetch first +1 rows only; -- works
select 1 offset -1 rows; -- ERROR: OFFSET must not be negative
select 1 fetch first -1 rows only; -- ERROR: LIMIT must not be negative

--
Andrew (irc:RhodiumToad)

Attachment Content-Type Size
ff2.patch text/x-patch 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2018-05-20 11:07:04 Re: Fix for FETCH FIRST syntax problems
Previous Message Charles Cui 2018-05-20 02:16:41 Re: [GSoC] Question about returning bytea array