From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Peter Kroon <plakroon(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: alter sequence |
Date: | 2012-11-24 11:40:15 |
Message-ID: | CAFj8pRB6-VBgeF8XDkHbz0fGOj=cZs=d6HY_CqTKSXAqtJdJoQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)gmail(dot)com>:
> ALTER SEQUENCE (select pg_get_serial_sequence('table', 'id')) RESTART WITH
> 1;
From | Date | Subject | |
---|---|---|---|
Next Message | Bill Moran | 2012-11-24 12:24:19 | Re: sefety of passwords for web-service applications |
Previous Message | Chris Angelico | 2012-11-24 11:37:18 | Partial authentication (was Re: sefety of passwords for web-service applications) |