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

Commit4405e74

Browse files
author
Neil Conway
committed
Regression tests for recent bugfix to ALTER TABLE ADD COLUMN: ensure that
constraints on domain types are properly enforced, even if the newlyadded column has no default value. Per bug #1433.
1 parentbeaf5ae commit4405e74

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,17 @@ drop domain ddef2 restrict;
300300
drop domain ddef3 restrict;
301301
drop domain ddef4 restrict;
302302
drop domain ddef5 restrict;
303+
-- Make sure that constraints of newly-added domain columns are
304+
-- enforced correctly, even if there's no default value for the new
305+
-- column. Per bug #1433
306+
create domain str_domain as text not null;
307+
create table domain_test (a int, b int);
308+
insert into domain_test values (1, 2);
309+
insert into domain_test values (1, 2);
310+
-- should fail
311+
alter table domain_test add column c str_domain;
312+
ERROR: domain str_domain does not allow null values
313+
create domain str_domain2 as text check (value <> 'foo') default 'foo';
314+
-- should fail
315+
alter table domain_test add column d str_domain2;
316+
ERROR: value for domain str_domain2 violates check constraint "str_domain2_check"

‎src/test/regress/sql/domain.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,21 @@ drop domain ddef2 restrict;
244244
dropdomain ddef3 restrict;
245245
dropdomain ddef4 restrict;
246246
dropdomain ddef5 restrict;
247+
248+
-- Make sure that constraints of newly-added domain columns are
249+
-- enforced correctly, even if there's no default value for the new
250+
-- column. Per bug #1433
251+
createdomainstr_domainastextnot null;
252+
253+
createtabledomain_test (aint, bint);
254+
255+
insert into domain_testvalues (1,2);
256+
insert into domain_testvalues (1,2);
257+
258+
-- should fail
259+
altertable domain_test add column c str_domain;
260+
261+
createdomainstr_domain2astextcheck (value<>'foo') default'foo';
262+
263+
-- should fail
264+
altertable domain_test add column d str_domain2;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp