Re: Rearranging ALTER TABLE to avoid multi-operations bugs

From: movead li <movead(dot)li(at)highgo(dot)ca>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Rearranging ALTER TABLE to avoid multi-operations bugs
Date: 2019-06-13 08:33:19
Message-ID: 156041479952.1280.2626916806999463144.pgcf@coridan.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I applied the 'alter-table-with-recursive-process-utility-calls-wip.patch'
on the master(e788e849addd56007a0e75f3b5514f294a0f3bca). And
when I test the cases, I find it works well on 'alter table t1 add column
f2 int not null, alter column f2 add generated always as identity' case,
but it doesn't work on #14827, #15180, #15670, #15710.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is the test result with #14827 failed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
postgres=# create table t10 (f1 int);
CREATE TABLE
postgres=# alter table t10 add column f2 int not null,
postgres-# alter column f2 add generated always as identity;
ALTER TABLE
postgres=#
postgres=# insert into t10 values(0);
INSERT 0 1
postgres=# create table test_serial ( teststring varchar(5));
CREATE TABLE
postgres=# alter table test_serial add column if not exists uid BIGSERIAL;
ALTER TABLE
postgres=# alter table test_serial add column if not exists uid BIGSERIAL;
psql: NOTICE: column "uid" of relation "test_serial" already exists, skipping
ALTER TABLE
postgres=#
postgres=# \d
List of relations
Schema | Name | Type | Owner
--------+----------------------+----------+--------------
public | t10 | table | lichuancheng
public | t10_f2_seq | sequence | lichuancheng
public | test_serial | table | lichuancheng
public | test_serial_uid_seq | sequence | lichuancheng
public | test_serial_uid_seq1 | sequence | lichuancheng
(5 rows)

postgres=#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So it's wrong with a 'test_serial_uid_seq1' sequence to appear.

The new status of this patch is: Waiting on Author

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2019-06-13 09:22:41 Re: BEFORE UPDATE trigger on postgres_fdw table not work
Previous Message Daniel Gustafsson 2019-06-13 08:31:23 Re: Backend specific ifdefs in sha2.h