Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1go3zP-00074H-5s for pgsql-general@arkaria.postgresql.org; Mon, 28 Jan 2019 10:18:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1go3zN-0006Ty-Uk for pgsql-general@arkaria.postgresql.org; Mon, 28 Jan 2019 10:18:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1go3zN-0006Tq-MY for pgsql-general@lists.postgresql.org; Mon, 28 Jan 2019 10:18:01 +0000 Received: from mailout05.t-online.de ([194.25.134.82]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1go3zM-0007uf-8r for pgsql-general@lists.postgresql.org; Mon, 28 Jan 2019 10:18:01 +0000 Received: from fwd02.aul.t-online.de (fwd02.aul.t-online.de [172.20.26.148]) by mailout05.t-online.de (Postfix) with SMTP id 03D0C422735E for ; Mon, 28 Jan 2019 11:17:58 +0100 (CET) Received: from musicman.homeip.net (XH+s0YZ1ZhsPubaPZZezHVssiJs0jNwN0ULZi-y-Z1SwNZ3O9cmituuKQBUgVYDggf@[80.144.254.34]) by fwd02.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1go3zK-2kJb5k0; Mon, 28 Jan 2019 11:17:58 +0100 Received: (qmail 8111 invoked by uid 0); 28 Jan 2019 10:17:57 -0000 Received: from 192.168.75.32 by amadeus4 (envelope-from , uid 82) with qmail-scanner-1.24 (sophos: 5.38.0/3.69.2/5.43. localrules: ???. Clear:RC:1(192.168.75.32):. Processed in 0.05043 secs); 28 Jan 2019 10:17:57 -0000 Received: from unknown (HELO noten19) (192.168.75.32) by amadeus4.local with SMTP; 28 Jan 2019 10:17:57 -0000 Received: (qmail 9498 invoked by uid 1000); 28 Jan 2019 10:17:56 -0000 Date: 28 Jan 2019 10:17:56 -0000 From: hamann.w@t-online.de Subject: data definition within plpgsql To: pgsql-general@lists.postgresql.org Message-Id: X-Mailer: TkMail 4.0beta9 Content-type: text/plain; charset=utf-8 X-Qmail-Scanner-1.24: added fake MIME-Version header MIME-Version: 1.0 X-ID: XH+s0YZ1ZhsPubaPZZezHVssiJs0jNwN0ULZi-y-Z1SwNZ3O9cmituuKQBUgVYDggf X-TOI-MSGID: e7837f34-6098-4e7b-8b8c-280733877a6d List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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