Re: alter sequence

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: alter sequence
Date: 2012-12-02 11:42:47
Message-ID: k9fern$32i$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2012-11-24, Peter Kroon <plakroon(at)gmail(dot)com> wrote:
> --f46d04389321c8f47d04cf3c0f32
> Content-Type: text/plain; charset=ISO-8859-1
>
> ALTER SEQUENCE (select pg_get_serial_sequence('table', 'id')) RESTART WITH
> 1;

> The query fails:
> ALTER SEQUENCE (select pg_get_serial_sequence('table...
> it's because of the (

you can end-run this problem by using the (undocumented ?) function setval:

select pg_catalog.setval(pg_get_serial_sequence('table','id') ,1,false);

--
⚂⚃ 100% natural

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2012-12-02 13:45:24 Re: alter sequence
Previous Message ivan marchesini 2012-12-02 10:52:42 Re: difference in query performance due to the inclusion of a polygon geometry field