From: hamann.w@t-online.de
To: pgsql-general@lists.postgresql.org
Subject: data definition within plpgsql
Date: 28 Jan 2019 10:17:56 -0000
Message-ID: <wolfgang-1190128111756.A0227604@noten19.local> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: hamann.w@t-online.de
Subject: Re: data definition within plpgsql
In-Reply-To: <wolfgang-1190128111756.A0227604@noten19.local>
References: <wolfgang-1190128111756.A0227604@noten19.local>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox