From: Raymond O'Donnell <rod@iol.ie>
To: Brahmam Eswar <brahmam1234@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] Reset Sequence number
Date: Wed, 22 Nov 2017 10:56:30 +0000
Message-ID: <20bd0fc8-0c02-32c6-91d2-7bdaeb085e7b@iol.ie> (raw)
In-Reply-To: <CA+wLFo3kRQh+qbY5stqipzGC1EPryd8aTRH3pY0=NxcXw_xo-A@mail.gmail.com>
References: <CA+wLFo3kRQh+qbY5stqipzGC1EPryd8aTRH3pY0=NxcXw_xo-A@mail.gmail.com>
On 22/11/17 09:36, Brahmam Eswar wrote:
>
> we are in process of migrating to postgres and need to reset the
> sequence number with highest value of table key . I want to make it
> procedural to do that as mentioned below,But it's throwing an error .
>
>
>
> DO $$
> DECLARE
> SEQ BIGINT;
> BEGIN
> SEQ:=(SELECT MAX(ID) FROM TABLE_1);
select max(id) into seq from table_1;
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie
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: rod@iol.ie, brahmam1234@gmail.com
Subject: Re: [GENERAL] Reset Sequence number
In-Reply-To: <20bd0fc8-0c02-32c6-91d2-7bdaeb085e7b@iol.ie>
References: <CA+wLFo3kRQh+qbY5stqipzGC1EPryd8aTRH3pY0=NxcXw_xo-A@mail.gmail.com> <20bd0fc8-0c02-32c6-91d2-7bdaeb085e7b@iol.ie>
* 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