Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite89f4c6

Browse files
committed
Fix test case to do what it intends to
This test case intended to fail because setting a column as generated tothe partitioned table while leaving the partition alone is not allowed;but instead failed because of a discrepancy of not-null constraint. Fixthis by adding the not-null constraint first, then set the column asgenerated in a separate ALTER TABLE command, which gets the expectederror. Also, because the next test also wants to set the column asnot-null, add a BEGIN/ROLLBACK block so that the added not-null isremoved.Oversight in6995863.
1 parent3ca43db commite89f4c6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

‎src/test/regress/expected/identity.out

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,13 @@ ALTER TABLE pitest3_p1
756756
ALTER COLUMN f3 ADD GENERATED ALWAYS AS IDENTITY (START WITH 3);
757757
ERROR: cannot add identity to a column of a partition
758758
-- fails, changing only the partitioned table not allowed
759+
BEGIN;
760+
ALTER TABLE pitest3_p1 ALTER COLUMN f3 SET NOT NULL;
759761
ALTER TABLE ONLY pitest3
760-
ALTER COLUMN f3 SET NOT NULL,
761762
ALTER COLUMN f3 ADD GENERATED ALWAYS AS IDENTITY (START WITH 3);
762-
ERROR:constraint must be addedtochild tables too
763+
ERROR:cannot add identitytoa column of only the partitioned table
763764
HINT: Do not specify the ONLY keyword.
765+
ROLLBACK;
764766
ALTER TABLE pitest3
765767
ALTER COLUMN f3 SET NOT NULL,
766768
ALTER COLUMN f3 ADD GENERATED ALWAYS AS IDENTITY (START WITH 3);

‎src/test/regress/sql/identity.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,11 @@ ALTER TABLE pitest3_p1
418418
ALTER COLUMN f3SETNOT NULL,
419419
ALTER COLUMN f3 ADD GENERATED ALWAYSAS IDENTITY (START WITH3);
420420
-- fails, changing only the partitioned table not allowed
421+
BEGIN;
422+
ALTERTABLE pitest3_p1 ALTER COLUMN f3SETNOT NULL;
421423
ALTERTABLE ONLY pitest3
422-
ALTER COLUMN f3SETNOT NULL,
423424
ALTER COLUMN f3 ADD GENERATED ALWAYSAS IDENTITY (START WITH3);
425+
ROLLBACK;
424426
ALTERTABLE pitest3
425427
ALTER COLUMN f3SETNOT NULL,
426428
ALTER COLUMN f3 ADD GENERATED ALWAYSAS IDENTITY (START WITH3);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp