How to display constraint using ESQL/C?

67 Views Asked by At

I have to output the constraint in my PostgreSQL using ESQL/C that I have set before directly with SQL. Below is the constraint I need to print out.

ALTER TABLE p
ADD CONSTRAINT check_name_of_det 
CHECK ((name = 'Screw' AND n_det = 'P6') OR n_det <>'P6');
1

There are 1 best solutions below

0
Laurenz Albe On BEST ANSWER

You can use the pg_get_constraintdef function. The argument is the object ID from pg_constraint.