public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jian He <[email protected]>
To: pgsql-sql <[email protected]>
Subject: Does postgresql know the check condition is valid or not. or can check deduce from multiple conditions
Date: Wed, 6 Apr 2022 09:37:55 +0530
Message-ID: <CAMV54g2OxGKMyuUVwNM0LdDZsvM7XJVbe4WmVRMLNTZ5X1d0Gg@mail.gmail.com> (raw)

If the question is stupid, please tell me why.

postgresql - How to query check the constraint is valid or not - Stack
Overflow
<https://stackoverflow.com/questions/71746611/how-to-query-check-the-constraint-is-valid-or-not;
Postgres 14 | db<>fiddle (dbfiddle.uk)
<https://dbfiddle.uk/?rdbms=postgres_14&fiddle=8157a4c1823635980019f3bdb1fa6835;

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 ));


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Does postgresql know the check condition is valid or not. or can check deduce from multiple conditions
  In-Reply-To: <CAMV54g2OxGKMyuUVwNM0LdDZsvM7XJVbe4WmVRMLNTZ5X1d0Gg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox