File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -314,3 +314,17 @@ create domain str_domain2 as text check (value <> 'foo') default 'foo';
314
314
-- should fail
315
315
alter table domain_test add column d str_domain2;
316
316
ERROR: value for domain str_domain2 violates check constraint "str_domain2_check"
317
+ -- Check that domain constraints on prepared statement parameters of
318
+ -- unknown type are enforced correctly.
319
+ create domain pos_int as int4 check (value > 0) not null;
320
+ prepare s1 as select $1::pos_int = 10 as "is_ten";
321
+ execute s1(10);
322
+ is_ten
323
+ --------
324
+ t
325
+ (1 row)
326
+
327
+ execute s1(0); -- should fail
328
+ ERROR: value for domain pos_int violates check constraint "pos_int_check"
329
+ execute s1(NULL); -- should fail
330
+ ERROR: domain pos_int does not allow null values
Original file line number Diff line number Diff line change @@ -262,3 +262,12 @@ create domain str_domain2 as text check (value <> 'foo') default 'foo';
262
262
263
263
-- should fail
264
264
alter table domain_test add column d str_domain2;
265
+
266
+ -- Check that domain constraints on prepared statement parameters of
267
+ -- unknown type are enforced correctly.
268
+ create domain pos_int as int4 check (value > 0 ) not null ;
269
+ prepare s1 as select $1 ::pos_int = 10 as " is_ten" ;
270
+
271
+ execute s1(10 );
272
+ execute s1(0 ); -- should fail
273
+ execute s1(NULL ); -- should fail
You can’t perform that action at this time.
0 commit comments