Thread: Does postgresql know the check condition is valid or not. or can check deduce from multiple conditions
Does postgresql know the check condition is valid or not. or can check deduce from multiple conditions
If the question is stupid, please tell me why.
postgresql - How to query check the constraint is valid or not - Stack Overflow
Postgres 14 | db<>fiddle (dbfiddle.uk)
CREATE TABLE emp (test_check int check ( test_check >1 and test_check < 0 ));
alter table emp VALIDATE CONSTRAINT emp_test_check_check;```
select * from pg_constraint where conname = 'emp_test_check_check';
Even with the above mentioned step, does postgresql know above check constraint condition always false.
another similar question:
can postgresql deduce from
CREATE TABLE emp1 (test_check int check ( test_check >1 and test_check > 10 ));
to
CREATE TABLE emp1 (test_check int check ( test_check > 10 ));
Re: Does postgresql know the check condition is valid or not. or can check deduce from multiple conditions
Jian He <hejian.mark@gmail.com> writes: > CREATE TABLE emp (test_check int check ( test_check >1 and test_check > < 0 )); > Even with the above mentioned step, does postgresql know above check > constraint condition always false. No, not explicitly. If the constraint always fails, that is your problem not Postgres'. regards, tom lane
Re: Does postgresql know the check condition is valid or not. or can check deduce from multiple conditions
If the question is stupid, please tell me why.
CREATE TABLE emp (test_check int check ( test_check >1 and test_check < 0 ));
alter table emp VALIDATE CONSTRAINT emp_test_check_check;```
select * from pg_constraint where conname = 'emp_test_check_check';
Even with the above mentioned step, does postgresql know above check constraint condition always false.
another similar question:
can postgresql deduce from
CREATE TABLE emp1 (test_check int check ( test_check >1 and test_check > 10 ));to
CREATE TABLE emp1 (test_check int check ( test_check > 10 ));