pgddl
pgddl copied to clipboard
Separate functions for pre- and post-data
As in pg_dump, there should be a way to dump just the bare bones of the DDL first, then the constraints.
Thanks! I will give this some thought and attention.
Current idea on how to do this is to add a second argument to functions, specifying options on how to dump stuff. Probably of type JSONB or text.
There is a function ddlx_create_class(regclass) already, which returns bare bones DDL (plus comments).
Other parts can be got by various other functions. See function ddlx_create(regclass) for example.
No need for options, but perhaps more of this should be made public API?
Not understanding how to call ddlx_create(regclass) to only get the constraints for a particular table. Please show an example.
You can't. Use the new ddlx_definitions function instead.
SELECT constraints
FROM ddlx_definitions('my_table'::regclass)
There are now several ways to do this (pre and post data):
- Use
ddlx_createonly(oid)andddlx_alter(oid)to get pre and post data parts respectively. - Use
ddlx_definitions(oid)and pick the columns you need - Use
ddlx_create(oid,'{noalter}')orddlx_script('{noalter}')to get pre-data only