diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index bb00858ad1..c1774f854d 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -4061,6 +4061,9 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, break; } + /* Experiment for bug report 14691. This doesn't do anything useful. */ + CheckTableForSerializableConflictIn(rel); + /* * Report the subcommand to interested event triggers. */ diff --git a/src/test/isolation/expected/add-column-concurrently.out b/src/test/isolation/expected/add-column-concurrently.out new file mode 100644 index 0000000000..ec70adadb1 --- /dev/null +++ b/src/test/isolation/expected/add-column-concurrently.out @@ -0,0 +1,31 @@ +Parsed test spec with 3 sessions + +starting permutation: s1b s1a s1u s2b s2s s1c s2c +step s1b: BEGIN ISOLATION LEVEL READ COMMITTED; +step s1a: ALTER TABLE foo ADD COLUMN y integer; +step s1u: UPDATE foo SET y = 0; +step s2b: BEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE; +step s2s: TABLE foo; +step s1c: COMMIT; +step s2s: <... completed> +x y + +1 +2 +3 +step s2c: COMMIT; + +starting permutation: s3b s3a s3u s2b s2s s3c s2c +step s3b: BEGIN ISOLATION LEVEL SERIALIZABLE; +step s3a: ALTER TABLE foo ADD COLUMN y integer; +step s3u: UPDATE foo SET y = 0; +step s2b: BEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE; +step s2s: TABLE foo; +step s3c: COMMIT; +step s2s: <... completed> +x y + +1 +2 +3 +step s2c: COMMIT; diff --git a/src/test/isolation/isolation_schedule b/src/test/isolation/isolation_schedule index 32c965b2a0..33e9ff80bf 100644 --- a/src/test/isolation/isolation_schedule +++ b/src/test/isolation/isolation_schedule @@ -1,3 +1,4 @@ +test: add-column-concurrently test: read-only-anomaly test: read-only-anomaly-2 test: read-only-anomaly-3 diff --git a/src/test/isolation/specs/add-column-concurrently.spec b/src/test/isolation/specs/add-column-concurrently.spec new file mode 100644 index 0000000000..98b54c9274 --- /dev/null +++ b/src/test/isolation/specs/add-column-concurrently.spec @@ -0,0 +1,34 @@ +# ADD COLUMN CONCURRENTLY +# +# Example from bug report 14691. + +setup +{ + CREATE TABLE foo(x integer); + INSERT INTO foo VALUES (1), (2), (3); +} + +teardown +{ + DROP TABLE foo; +} + +session "s1" +step "s1b" { BEGIN ISOLATION LEVEL READ COMMITTED; } +step "s1a" { ALTER TABLE foo ADD COLUMN y integer; } +step "s1u" { UPDATE foo SET y = 0; } +step "s1c" { COMMIT; } + +session "s2" +step "s2b" { BEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE; } +step "s2s" { TABLE foo; } +step "s2c" { COMMIT; } + +session "s3" +step "s3b" { BEGIN ISOLATION LEVEL SERIALIZABLE; } +step "s3a" { ALTER TABLE foo ADD COLUMN y integer; } +step "s3u" { UPDATE foo SET y = 0; } +step "s3c" { COMMIT; } + +permutation "s1b" "s1a" "s1u" "s2b" "s2s" "s1c" "s2c" +permutation "s3b" "s3a" "s3u" "s2b" "s2s" "s3c" "s2c"