Can I autogenerate SQL code for existing constraint in postgres and get it like the result of other sql query? Pgadmin can do it , but i need the sql query for constraint by it's name.
Thanks in advance
Asked
Active
Viewed 77 times
1
-
Thanks Ulad Kasach for this gem: https://stackoverflow.com/a/62548144/13467309 – Hu Man Jul 13 '20 at 23:06
1 Answers
0
You should use the pg_get_constraintdef
function to construct an SQL statement for the constraint definition.

Laurenz Albe
- 209,280
- 17
- 206
- 263