Re: [GENERAL] Reset Sequence number

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Brahmam Eswar <brahmam1234(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Reset Sequence number
Date: 2017-11-22 10:56:30
Message-ID: 20bd0fc8-0c02-32c6-91d2-7bdaeb085e7b@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)iol(dot)ie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Wèi Cōngruì 2017-11-22 11:00:17 Re: [GENERAL] Reset Sequence number
Previous Message Rupesh Mashru 2017-11-22 10:44:12 Error "XX000: cache lookup failed for index 901261397"