| From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
|---|---|
| To: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: alter sequence |
| Date: | 2012-12-02 13:45:24 |
| Message-ID: | 1354455924.4185.9.camel@localhost.localdomain |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Sun, 2012-12-02 at 11:42 +0000, Jasen Betts wrote:
> 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);
>
It's documented:
http://www.postgresql.org/docs/9.2/interactive/functions-sequence.html
for setval and
http://www.postgresql.org/docs/9.2/static/functions-info.html for
pg_get_serial_sequence.
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | rahul143 | 2012-12-02 15:04:56 | ERROR: query has no destination for result data |
| Previous Message | Jasen Betts | 2012-12-02 11:42:47 | Re: alter sequence |