In pgAdmin 3 (and pgAdmin 4 if you're prepared to wait longer) the DDL for the currently selected database object is shown in the main panel, along with corresponding triggers, constraints, etc, all nicely formatted. It looks quite different to the DDL exported from pgdump. Is there a way to get the nicer version, without manually copy-and-pasting from pgAdmin?
1 Answer
Digging around in the pgAdmin source code it appears that the routines to generate the DDL are embedded within the application code. For instance, I the code to generate the table DDL can be found in pgTable::GetSql
.
pg_get_functiondef
andpg_get_viewdef
don't do the same pretty-printing PgAdmin does, so no, I don't think so.