From: | Andreas Pflug <pgadmin(at)pse-consulting(dot)de> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: ruleutils with pretty-print option |
Date: | 2003-07-21 09:33:54 |
Message-ID: | 3F1BB382.1020309@pse-consulting.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Hi Bruce,
so here's the complete patch against the current cvs.
Description:
The attached patches will add
pg_get_ruledef(oid, bool)
pg_get_viewdef(text, bool)
pg_get_viewdef(oid, bool)
pg_get_indexdef(oid, int4, bool)
pg_get_constraintdef(oid, bool)
pg_get_expr(text, oid, bool)
If the last parameter "pretty-print" is false, these function will
return the same result as their original counterparts without that
parameter. The source is based on ruleutils.c 1.145 and pg_proc 1.309,
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.
If the last parameter "pretty-print" is true, parentheses are checked;
only necessary parentheses will be emitted. Additionally, line and
indentation formatting is performed.
pg_get_indexdef has one additional parameter. The second parameter
(int4) 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 described.
example:
pg_get_indexdef(12345, 0, true) -> CREATE INDEX foo ON bar (numcol,
length(txtcol), intcol2, (8+length(txtcol2)))
pg_get_indexdef(12345, 1, true) -> numcol
pg_get_indexdef(12345, 2, true) -> length(txtcol)
pg_get_indexdef(12345, 3, true) -> intcol2
pg_get_indexdef(12345, 4, true) -> (8+length(txtcol2))
Regards,
Andreas
Attachment | Content-Type | Size |
---|---|---|
pg_proc.h.diff | text/plain | 1.4 KB |
ruleutils.c.patch | text/plain | 29.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Rod Taylor | 2003-07-21 12:36:13 | Re: Release.sgml markup |
Previous Message | Böjthe Zoltán | 2003-07-21 08:54:47 | Re: timetravel.c |