Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YfUwk-0001UZ-OL for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Apr 2015 14:57:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YfUwk-0008BF-0m for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Apr 2015 14:57:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YfKo7-00071D-58 for pgsql-bugs@postgresql.org; Tue, 07 Apr 2015 04:08:11 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YfKny-0002N0-UX for pgsql-bugs@postgresql.org; Tue, 07 Apr 2015 04:08:09 +0000 MIME-Version: 1.0 Subject: BUG #12991: RESTART IDENTITY is not doing anything To: pgsql-bugs@postgresql.org From: antoine@goutenoir.com Date: Tue, 07 Apr 2015 04:07:56 +0000 Message-ID: <20150407040756.2552.47640@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.2 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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