summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/identity.out6
-rw-r--r--src/test/regress/sql/identity.sql6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/test/regress/expected/identity.out b/src/test/regress/expected/identity.out
index 7cf4696ec95..1a614b85f99 100644
--- a/src/test/regress/expected/identity.out
+++ b/src/test/regress/expected/identity.out
@@ -409,6 +409,12 @@ ALTER TABLE itest8
ALTER COLUMN f5 DROP NOT NULL,
ALTER COLUMN f5 SET DATA TYPE bigint;
INSERT INTO itest8 VALUES(0), (1);
+-- This does not work when the table isn't empty. That's intentional,
+-- since ADD GENERATED should only affect later insertions:
+ALTER TABLE itest8
+ ADD COLUMN f22 int NOT NULL,
+ ALTER COLUMN f22 ADD GENERATED ALWAYS AS IDENTITY;
+ERROR: column "f22" contains null values
TABLE itest8;
f1 | f2 | f3 | f4 | f5
----+----+----+----+----
diff --git a/src/test/regress/sql/identity.sql b/src/test/regress/sql/identity.sql
index 685607c90c1..b4cdd21bdd4 100644
--- a/src/test/regress/sql/identity.sql
+++ b/src/test/regress/sql/identity.sql
@@ -269,6 +269,12 @@ ALTER TABLE itest8
INSERT INTO itest8 VALUES(0), (1);
+-- This does not work when the table isn't empty. That's intentional,
+-- since ADD GENERATED should only affect later insertions:
+ALTER TABLE itest8
+ ADD COLUMN f22 int NOT NULL,
+ ALTER COLUMN f22 ADD GENERATED ALWAYS AS IDENTITY;
+
TABLE itest8;
\d+ itest8
\d itest8_f2_seq