From: antoine@goutenoir.com
To: pgsql-bugs@postgresql.org
Subject: BUG #12991: RESTART IDENTITY is not doing anything
Date: Tue, 07 Apr 2015 04:07:56 +0000
Message-ID: <20150407040756.2552.47640@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 12991
Logged by: Goutte
Email address: antoine@goutenoir.com
PostgreSQL version: 9.3.6
Operating system: Linux 3.13.0-45-generic x86_64 GNU/Linux
Description:
The bug is pretty straightforward, the doc is crystal clear about the role
of RESTART IDENTITY, and this is not listed is the known bugs.
For my test suite, I have to restart the identity sequences while
truncating.
I need the TRUNCATE to CASCADE too, but I don't know if it is meaningful.
Example, say Article has `id` as primary key :
TRUNCATE TABLE Article RESTART IDENTITY CASCADE;
On the next insertion, the sequence will continue from where it was before
instead of being resetted. The table is successfully truncated, though.
I solve it by doing, right after :
ALTER SEQUENCE Article_id_seq RESTART WITH 1;
This works and restarts the sequence.
---
I observe this behavior (or non-behavior in this case) on the cli using the
`psql` binary, and programmatically in PHP, so I'm sure this is not my
connector acting up.
---
Please note that I'm a pgSQL absolute noob (first day), and I'm using it
because of the awesome `earthdistances` extension.
Maybe I missed something obvious !
Good day to you,
Antoine
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: antoine@goutenoir.com
Subject: Re: BUG #12991: RESTART IDENTITY is not doing anything
In-Reply-To: <20150407040756.2552.47640@wrigleys.postgresql.org>
References: <20150407040756.2552.47640@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox