pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Japin Li <japinli@hotmail.com>
Cc: Etsuro Fujita <etsuro.fujita@gmail.com>
Cc: onderkalaci@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18467: postgres_fdw (deparser) ignores LimitOption
Date: Thu, 16 May 2024 17:27:18 +0200
Message-ID: <202405161527.2rs7jfxkxl6m@alvherre.pgsql> (raw)
In-Reply-To: <ME3P282MB31666446BF8A0C0F7A02D24CB6ED2@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM>

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/





view thread (28+ messages)  latest in thread

Message-ID: <202405161527.2rs7jfxkxl6m@alvherre.pgsql>
Permalink:  ../202405161527.2rs7jfxkxl6m@alvherre.pgsql/
Also on:    postgresql.org/message-id/202405161527.2rs7jfxkxl6m@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@alvh.no-ip.org, japinli@hotmail.com, etsuro.fujita@gmail.com, onderkalaci@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18467: postgres_fdw (deparser) ignores LimitOption
  In-Reply-To: <202405161527.2rs7jfxkxl6m@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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