Re: BUG #18467: postgres_fdw (deparser) ignores LimitOption
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Japin Li <japinli@hotmail.com>
Cc: Etsuro Fujita <etsuro.fujita@gmail.com>, onderkalaci@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2024-05-16T15:27:18Z
Lists: pgsql-bugs
On 2024-May-16, Japin Li wrote:
> I find that the FETCH FIRST ... ROWS WITH TIES does not support type casting.
> For example:
>
> postgres=# SELECT * FROM pg_class ORDER BY relname FETCH FIRST 2::bigint ROWS WITH TIES;
> ERROR: syntax error at or near "::"
> LINE 1: ...ECT * FROM pg_class ORDER BY relname FETCH FIRST 2::bigint R...
> ^
Why do you need this? The standard says
<fetch first clause> ::= FETCH { FIRST | NEXT } [ <fetch first quantity> ] { ROW | ROWS } { ONLY | WITH TIES }
<fetch first quantity> ::= <fetch first row count> | <fetch first percentage>
<offset row count> ::= <simple value specification>
<fetch first row count> ::= <simple value specification>
which doesn't seem to leave room for a cast.
I didn't try super extensively, but this works:
select 1 from pg_class fetch first 281474976710656 rows only;
so the count is already not restricted to be an int32 value.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
Commits
-
postgres_fdw: Refuse to send FETCH FIRST WITH TIES to remote servers.
- 2b461efc5195 13.16 landed
- 269e2c391628 14.13 landed
- b33c141cc52b 15.8 landed
- 8405d5a37a25 16.4 landed
- 8cfbac1492bd 17.0 landed
-
Revert temporal primary keys and foreign keys
- 8aee330af55d 17.0 cited