From: | hvjunk <hvjunk(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: "alter table...if exists... add bigserial "still adds extra sequence |
Date: | 2017-09-25 08:34:54 |
Message-ID: | BFAB21B5-03EE-4A13-91A6-747A96CAEE52@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> On 25 Sep 2017, at 09:51 , hvjunk <hvjunk(at)gmail(dot)com> wrote:
>
> Good day,
>
> See the sequence below, Postgresql 9.6.5 on Debian using the postgresql repository.
>
> Question: Is this expected behaviour?
I guess it might be, but the “bug” is that the excessive/unused sequence isn’t removed:
test=# \d test_serial
Table "public.test_serial"
Column | Type | Modifiers
------------+----------------------+-----------------------------------------------------------
teststring | character varying(5) |
uid | bigint | not null default nextval('test_serial_uid_seq'::regclass)
>
>
>
> postgres(at)tracsdbhvt01:~$ cat test-serial.sql
> create database test;
> \c test
> create table test_serial ( teststring varchar(5));
> alter table test_serial add column if not exists uid BIGSERIAL;
> alter table test_serial add column if not exists uid BIGSERIAL;
> \d
>
> postgres(at)tracsdbhvt01:~$ psql -p 5433 < test-serial.sql
> CREATE DATABASE
> You are now connected to database "test" as user "postgres".
> CREATE TABLE
> ALTER TABLE
> NOTICE: column "uid" of relation "test_serial" already exists, skipping
> ALTER TABLE
> List of relations
> Schema | Name | Type | Owner
> --------+----------------------+----------+----------
> public | test_serial | table | postgres
> public | test_serial_uid_seq | sequence | postgres
> public | test_serial_uid_seq1 | sequence | postgres
> (3 rows)
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Vladimir Mihailenco | 2017-09-25 09:10:32 | Re: shared_buffers smaller than max_wal_size |
Previous Message | hvjunk | 2017-09-25 07:51:49 | "alter table...if exists... add bigserial "still adds extra sequence |