karver35
karver35

Reputation: 31

How to display constraint using ESQL/C?

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

Upvotes: -2

Views: 73

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247800

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

Upvotes: 1

Related Questions