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');
You can use the pg_get_constraintdef
function. The argument is the object ID from pg_constraint
.