data definition within plpgsql - Mailing list pgsql-general

From hamann.w@t-online.de
Subject data definition within plpgsql
Date
Msg-id wolfgang-1190128111756.A0227604@noten19.local
Whole thread Raw
Responses Re: data definition within plpgsql  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: data definition within plpgsql  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-general

Hi,

I tried this code (to be inserted within a larger psql script)

do $_$
declare
    next int;
begin
    select max(id) + 1 into next from items;
    execute 'create temp sequence tmp_ids start $1' using next;
end
$_$ language plpgsql;

but that reports a syntax error near $1.
What is the proper way of doing that?

Best regards
Wolfgang Hamann



pgsql-general by date:

Previous
From: Thomas Schweikle
Date:
Subject: logical replication problem
Next
From: Thomas Schweikle
Date:
Subject: Re: logical replication problem