Skip to main content

Hi

I've got a PostGres server I want to extract the public schema from. I can get the code to work and extract the ERD to a CSV file. However the code provided by Lucid (Below) doesn't extract the relationships between tables?



"SET enable_nestloop=0;SELECT 'postgresql' AS dbmst.table_catalogt.table_schemat.table_namec.column_namec.ordinal_positionc.data_typec.character_maximum_lengthn.constraint_typek2.table_schemak2.table_namek2.column_name FROM information_schema.tables t NATURAL LEFT JOIN information_schema.columns c LEFT JOIN(information_schema.key_column_usage k NATURAL JOIN information_schema.table_constraints n NATURAL LEFT JOIN information_schema.referential_constraints r)ON c.table_catalog=k.table_catalog AND c.table_schema=k.table_schema AND c.table_name=k.table_name AND c.column_name=k.column_name LEFT JOIN information_schema.key_column_usage k2 ON k.position_in_unique_constraint=k2.ordinal_position AND r.unique_constraint_catalog=k2.constraint_catalog AND r.unique_constraint_schema=k2.constraint_schema AND r.unique_constraint_name=k2.constraint_name WHERE t.TABLE_TYPE='BASE TABLE' AND t.table_schema NOT IN('information_schema''pg_catalog');"



I've checked inside PostGres and the Relationships there are active and I can interact with them. But I can't see to get an export of them?



Why is this? Can anyone help?

Hi Nik thanks for posting in the Lucidchart Community! I’m sorry for the trouble you are having with Entity Relationship Diagrams. Since troubleshooting will require some potentially sensitive information I have moved your post into a one on one email troubleshooting ticket and will follow up there. 

For any other questions around ERDs in Lucidchart please review our ERD article from the Lucidchart Help Center. 


Reply