From: | Andreas Pflug <pgadmin(at)pse-consulting(dot)de> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | ruleutils with pretty-print option |
Date: | 2003-07-06 10:11:56 |
Message-ID: | 3F07F5EC.50103@pse-consulting.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Is there a problem about the archive?
I posted this addition to the patch on July 2, and received it over the
patches mailing list. Still, it doesn't appear in cvs, in "unapplied
patches" or in the mailing list archive! So although that message made
its way through the list server, it didn't end up in the archive, but
was lost.
In the meantime, some changes occurred to cvs, which merged smoothly.
For convenience, the attached diffs against the latest cvs versions.
Regards,
Andreas
Previous message (2003-07-02):
The patch has been updated, the attached files will replace my previous
post completely against ruleutils.c 1.143.
pg_get_indexdef is extended to take 3 arguments:
pg_get_indexdef(index_oid, columnNr_int, prettyOpt_int)
Still, pg_get_indexdef(oid) will deliver the same result as it used to be.
The second parameter selects the nth expression of an index
(1..indnatts). If zero, a complete CREATE INDEX statement is generated
to obtain the previous behaviour.
The third is the pretty-print option as mentioned before.
example:
pg_get_indexdef(12345, 0, 7) -> CREATE INDEX foo ON bar (numcol,
length(txtcol), intcol2, length(txtcol2))
pg_get_indexdef(12345, 1, 7) -> numcol
pg_get_indexdef(12345, 2, 7) -> length(txtcol)
Regards,
Andreas
> The attached patches will add
> pg_get_ruledef(oid, int)
> pg_get_viewdef(text, int)
> pg_get_viewdef(oid, int)
> pg_get_indexdef(oid, int)
> pg_get_constraintdef(oid, int)
> pg_get_expr(text, oid, int)
>
> If the last parameter "pretty-print" is 0, these function will return
> the same result as their original counterparts without that parameter.
> The source is based on ruleutils.c 1.143, and should return exactly
> the same result as before if no pretty-print is selected. My tests
> didn't show any differences for pg_dump output with old or new version.
>
> The pretty-print parameter is evaluated bit-wise.
>
> PRETTY_PAREN 1 - Parentheses are checked; only necessary
> parentheses will be emitted.
>
> PRETTY_INDENT 2 - pretty indentation and line formatting is performed
>
> PRETTY_OPPAREN 4 - For T_BoolExpr operators, AND/OR/NOT precedence
> is checked, for T_OpExpr +-*/% precedence is
> checked. If precedence is identified, parentheses are omitted.
> This option is only active if PRETTY_PAREN is
> also used.
Attachment | Content-Type | Size |
---|---|---|
pg_proc.h.patch-309 | text/plain | 1.7 KB |
ruleutils.c.patch-1.145 | text/plain | 55.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Shridhar Daithankar | 2003-07-06 14:10:32 | Another POC initdb patch |
Previous Message | Greg Stark | 2003-07-06 04:35:48 | Re: Autoconf test for incompatible version of flex |