Re: alter sequence - Mailing list pgsql-general

From Pavel Stehule
Subject Re: alter sequence
Date
Msg-id CAFj8pRB6-VBgeF8XDkHbz0fGOj=cZs=d6HY_CqTKSXAqtJdJoQ@mail.gmail.com
Whole thread Raw
In response to alter sequence  (Peter Kroon <plakroon@gmail.com>)
List pgsql-general
Hello

you can't to do it directly. Expression cannot be used instead object name

you can use a plpgsql DO in this moment

DO $$
BEGIN
  EXECUTE format('ALTER SEQUENCE %I RESTART WITH 1',
pg_get_serial_sequence('table', 'id'));
END;
$$ LANGUAGE plpgsql;

Regards

Pavel Stehule

2012/11/24 Peter Kroon <plakroon@gmail.com>:
> ALTER SEQUENCE (select pg_get_serial_sequence('table', 'id')) RESTART WITH
> 1;


pgsql-general by date:

Previous
From: Chris Angelico
Date:
Subject: Partial authentication (was Re: sefety of passwords for web-service applications)
Next
From: Bill Moran
Date:
Subject: Re: sefety of passwords for web-service applications