Erik Erkelens <[EMAIL PROTECTED]> writes:
>     DECLARE 
>         new_max_records ALIAS FOR $1;
>     BEGIN
>         CREATE SEQUENCE my_sequence MAXVALUE new_max_records CYCLE;

> ERROR:  parser: parse error at or near "$1" at character 39

You'll need to use EXECUTE to construct and execute that CREATE
SEQUENCE.  Utility statements generally don't accept runtime parameters,
which is what the plpgsql variable looks like to the main parser.

> Also, if there is a better mechanism to implement
> this, I'm all ears...

There's an ALTER SEQUENCE command in CVS tip, though I'm not sure
I trust it in concurrent-usage scenarios :-(

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to