Re: BUG #6617: FETCH FIRST syntax accepts only constants and not parameters

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <dodobas(at)geoinfo(dot)geof(dot)hr>,<pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #6617: FETCH FIRST syntax accepts only constants and not parameters
Date: 2012-04-26 16:52:06
Message-ID: 4F9936E602000025000473F2@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

<dodobas(at)geoinfo(dot)geof(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Josh Berkus 2012-04-26 17:34:48 291 pg_toast_temp schemas?
Previous Message dodobas 2012-04-26 16:02:21 BUG #6617: FETCH FIRST syntax accepts only constants and not parameters