Re: BUG #6617: FETCH FIRST syntax accepts only constants and not parameters - Mailing list pgsql-bugs

From Kevin Grittner
Subject Re: BUG #6617: FETCH FIRST syntax accepts only constants and not parameters
Date
Msg-id 4F9936E602000025000473F2@gw.wicourts.gov
Whole thread Raw
In response to BUG #6617: FETCH FIRST syntax accepts only constants and not parameters  (dodobas@geoinfo.geof.hr)
List pgsql-bugs
<dodobas@geoinfo.geof.hr> wrote:

> When tried setting FETCH FIRST parameter dynamically in RETURN
> QUERY EXECUTE some_query USING param1 it resulted with a syntax
> error on FETCH FIRST parameter.
>
> Apparently, it only accepts constants so it works with ($1)

That's not a bug.  Use the parentheses as specified in the
documentation:

http://www.postgresql.org/docs/9.1/interactive/sql-select.html#SQL-LIMIT

| to write anything except a simple integer constant for start or
| count, you must write parentheses around it.

-Kevin

pgsql-bugs by date:

Previous
From: dodobas@geoinfo.geof.hr
Date:
Subject: BUG #6617: FETCH FIRST syntax accepts only constants and not parameters
Next
From: Josh Berkus
Date:
Subject: 291 pg_toast_temp schemas?