snippetsqlMinor
How does pgAdmin III build CREATE statements?
Viewed 0 times
pgadmincreatestatementsdoeshowiiibuild
Problem
In PostgreSQL, there is no
So here is my question:
How does pgAdmin III build the CREATE statements it shows? Does it use psql's
SHOW CREATE statement, known for example from MySQL. But when you use the pgAdmin III client program and go to object details, you see the corresponding CREATE statement.So here is my question:
How does pgAdmin III build the CREATE statements it shows? Does it use psql's
\d command or some completely different PostreSQL API? If so, how can I use it?Solution
pgadmin has it's own reverse-engineering functionality - it just examines the system tables like
If what you're looking for is actually an easy way to show the CREATE statements for your objects that you can use from something else, you should look at
pg_class and pg_attribute to find the details.If what you're looking for is actually an easy way to show the CREATE statements for your objects that you can use from something else, you should look at
pg_dump instead of pgadmin, it is much simpler. In particular, if you just want to look at it for one or more object, you can use pg_dump -s -t tablename and it will give you the required CREATE statements.Context
StackExchange Database Administrators Q#12148, answer score: 5
Revisions (0)
No revisions yet.