On Thu, Jan 10, 2013 at 11:07 PM, Andrew Dunstan <and...@dunslane.net>wrote:
> > On 01/10/2013 12:35 PM, Tom Lane wrote: > >> Andrew Dunstan <and...@dunslane.net> writes: >> >>> I think there's a very good case for breaking the nexus between >>> PRETTYFLAG_PAREN and PRETTYFLAG_INDENT+line wrapping for views. Only >>> PRETTYFLAG_PAREN affects the safety issue. The others are just about >>> white space in safe places. >>> >> What I was actually thinking about was turning on indent/linewrapping >> all the time (ie, no change on pg_dump's side, just hack ruleutils). >> If we believe it's safe, why not just do it? It's the paren-removal >> that pg_dump can't tolerate. >> >> >> > > Works for me. > > Nice idea. Marko, just hack ruleutils some thing like this: diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 266cec5..a46f588 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -511,8 +511,9 @@ pg_get_viewdef(PG_FUNCTION_ARGS) { /* By OID */ Oid viewoid = PG_GETARG_OID(0); + int prettyFlags = PRETTYFLAG_INDENT; - PG_RETURN_TEXT_P(string_to_text(pg_get_viewdef_worker(viewoid, 0, -1))); + PG_RETURN_TEXT_P(string_to_text(pg_get_viewdef_worker(viewoid, prettyFlags, WRAP_COLUMN_DEFAULT))); } Thanks > cheers > > andrew > > > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/**mailpref/pgsql-hackers<http://www.postgresql.org/mailpref/pgsql-hackers> > -- Jeevan B Chalke Senior Software Engineer, R&D EnterpriseDB Corporation The Enterprise PostgreSQL Company Phone: +91 20 30589500 Website: www.enterprisedb.com EnterpriseDB Blog: http://blogs.enterprisedb.com/ Follow us on Twitter: http://www.twitter.com/enterprisedb This e-mail message (and any attachment) is intended for the use of the individual or entity to whom it is addressed. This message contains information from EnterpriseDB Corporation that may be privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient or authorized to receive this for the intended recipient, any use, dissemination, distribution, retention, archiving, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and delete this message.