Parameters don't work in FETCH NEXT clause? - Mailing list pgsql-hackers

From Shay Rojansky
Subject Parameters don't work in FETCH NEXT clause?
Date
Msg-id CADT4RqBmMaPM03QrZ0w0MqQkxNpRg07FnyQWpCD0j9NSbzAo9Q@mail.gmail.com
Whole thread Raw
Responses Re: Parameters don't work in FETCH NEXT clause?
List pgsql-hackers
A user of mine just raised a strange issue... While it is possible to use a parameter in a LIMIT clause, PostgreSQL does not seem to allow using one in a FETCH NEXT clause. In other words, while the following works:

SELECT 1 LIMIT $1;

The following generates a syntax error:

SELECT 1 FETCH NEXT $1 ROWS ONLY;

Since LIMIT and FETCH NEXT are supposed to be equivalent this behavior is odd.

More generally, is there some documentation on where exactly PostgreSQL allows parameters and where it doesn't? I occasionally get complaints from users expecting parameters to work in DDL, or even in table/column names in SELECT queries... I haven't seen a resource like this.

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Backup doc typo
Next
From: Tom Lane
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Correctly align page's images in generic wal API