Skip to main content

I have a PostGres DB 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 doesn't extract the relationships between tables?  The following column is missing some data:   character_maximum_length 


The following columns are EMPTY:  constraint_type   table_schema table_name column_name


 


help please

Hi Dan thanks for posting in the Lucid Community! Just to confirm I am understanding the issue correctly- it sounds like you grabbed the query for PostgreSQL provided in the first step of our ERD import feature (as described here) ran this query in your database and saved the output as a CSV file but the columns you mentioned were actually empty in the output file- is that correct? 


As a first step can you double-check that you selected the correct query for PostgreSQL from the ERD import window? I have also pasted this below for your reference. 


If that doesn't help would you mind reaching out to the Lucid Support team directly using this form so we can take a closer look at the issue? Please include the output file you received after running the query in your DB. Thanks!


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

Reply