contribute pg_get_viewdef2 et al

From: Andreas Pflug <Andreas(dot)Pflug(at)web(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: contribute pg_get_viewdef2 et al
Date: 2003-05-06 15:17:08
Message-ID: 3EB7D1F4.7080002@web.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom,

when I made the proposal to reduce the number of parentheses emitted by
pg_get_viewdef and the other routines implemented in ruleutils.c, you
were quite declining on this, stating that any erroneous left out pair
of parentheses would screw up pg_dump's backup files, making a restore
fail to reproduce the exact database state.

As an alternative, I now implemented pg_get_viewdef2, pg_get_ruledef2,
pg_get_expr2 doing the same stuff as the versions without '2', but
omitting parentheses not needed (hopefully, review appreciated) in a
contribute module. pgadmin3 will use these versions, if present, or fall
back to the standard versions. Additionally, pgadmin3 will indent and
add crlf, which could be done inside pg_get_xxxx2 too.

I think this way we have both: secure but human unreadable form for
backup/restore, and a better readable form for user interface.
Actually, a third way, preserving the original query in a dedicated
pg_rewrite column, would be even better for this purpose, because
formatting and comments wouldn't be stripped which can be quite helpful
after some months to know what's happening. AFAICS this would require
pg_dump/pg_restore to save and update this column after creating the
view from pg_get_ruledef().

Regards,

Andreas

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2003-05-06 15:17:51 Re: Hypothetical suggestions for planner, indexing improvement
Previous Message Zeugswetter Andreas SB SD 2003-05-06 15:05:44 Re: Hypothetical suggestions for planner, indexing improvement