-
Notifications
You must be signed in to change notification settings - Fork 0
WIP pretty printing support #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/PG-151
Are you sure you want to change the base?
Conversation
| #define GET_DDL_PRETTY_FLAGS(pretty) \ | ||
| ((pretty) ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) \ | ||
| : 0) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #define GET_DDL_PRETTY_FLAGS(pretty) \ | |
| ((pretty) ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) \ | |
| : 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like adding the GET_DDL_PRETTY_FLAGS, but maybe it's just me. If you have a strong feeling, let it be as it is
| bool pretty = PG_GETARG_BOOL(1); | ||
| char *res; | ||
| int prettyFlags; | ||
|
|
||
| prettyFlags = GET_DDL_PRETTY_FLAGS(pretty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| bool pretty = PG_GETARG_BOOL(1); | |
| char *res; | |
| int prettyFlags; | |
| prettyFlags = GET_DDL_PRETTY_FLAGS(pretty); | |
| bool pretty; | |
| char *res; | |
| int prettyFlags = true; | |
| if (PG_ARGISNULL(1)) | |
| pretty = PG_GETARG_BOOL(1); | |
| prettyFlags = pretty ? PRETTYFLAG_INDENT : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose this, instead of the GET_DDL_PRETTY_FLAGS, but it's your choice.
| CREATE OR REPLACE FUNCTION | ||
| pg_get_domain_ddl(domain_name regtype, pretty bool DEFAULT false) | ||
| RETURNS text | ||
| LANGUAGE internal | ||
| AS 'pg_get_domain_ddl_ext'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
Isn't it better to have it in pg_proc.dat, also the one with a one-argument signature?
| { oid => '8024', descr => 'get CREATE statement for DOMAIN with pretty option', | ||
| proname => 'pg_get_domain_ddl', prorettype => 'text', | ||
| proargtypes => 'regtype', prosrc => 'pg_get_domain_ddl' }, | ||
| proargtypes => 'regtype bool', prosrc => 'pg_get_domain_ddl_ext' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| proargtypes => 'regtype bool', prosrc => 'pg_get_domain_ddl_ext' }, | |
| proargtypes => 'regtype bool', prosrc => 'pg_get_domain_ddl_ext' }, | |
| { oid => '8025', descr => 'get CREATE statement for DOMAIN', | |
| proname => 'pg_get_domain_ddl', prorettype => 'text', | |
| proargtypes => 'regtype', prosrc => 'pg_get_domain_ddl_ext' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this instead of adding the create function, better to have all teh changes in one place, maybe...
No description provided.