Re: ruleutils with pretty-print option

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Andreas Pflug" <pgadmin(at)pse-consulting(dot)de>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: ruleutils with pretty-print option
Date: 2003-07-31 05:15:04
Message-ID: 00c101c35722$b419a530$2800a8c0@mars
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Didn't Tom already apply that???

Chris

----- Original Message -----
From: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Andreas Pflug" <pgadmin(at)pse-consulting(dot)de>;
<pgsql-patches(at)postgresql(dot)org>
Sent: Thursday, July 31, 2003 12:52 PM
Subject: Re: [PATCHES] ruleutils with pretty-print option

>
> I didn't like the functions ending in _ext. I renamed them to _pp for
> pretty print. Patch attached and applied.
>
> --------------------------------------------------------------------------
-
>
> Tom Lane wrote:
> > Andreas Pflug <pgadmin(at)pse-consulting(dot)de> writes:
> > > I recoded the stuff as Tom recommended, leaving the non-pretty version
> > > function names as they used to be, inventing new pg_get_XXXX_ext
> > > functions for the extended stuff, and pushing the code down into
> > > pg_get_XXXX_worker functions when needed. We now need the additional
> > > prototype include patch from builtins.h.
> >
> > Applied with some editorializing. In particular, I don't believe the
> > original did the right thing with (a - (b - c)).
> >
> > regards, tom lane
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
> >
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania
19073
>

----------------------------------------------------------------------------
----

> Index: src/backend/utils/adt/ruleutils.c
> ===================================================================
> RCS file: /cvsroot/pgsql-server/src/backend/utils/adt/ruleutils.c,v
> retrieving revision 1.147
> diff -c -c -r1.147 ruleutils.c
> *** src/backend/utils/adt/ruleutils.c 30 Jul 2003 22:56:23 -0000 1.147
> --- src/backend/utils/adt/ruleutils.c 31 Jul 2003 04:48:35 -0000
> ***************
> *** 228,234 ****
>
>
> Datum
> ! pg_get_ruledef_ext(PG_FUNCTION_ARGS)
> {
> Oid ruleoid = PG_GETARG_OID(0);
> bool pretty = PG_GETARG_BOOL(1);
> --- 228,234 ----
>
>
> Datum
> ! pg_get_ruledef_pp(PG_FUNCTION_ARGS)
> {
> Oid ruleoid = PG_GETARG_OID(0);
> bool pretty = PG_GETARG_BOOL(1);
> ***************
> *** 337,343 ****
>
>
> Datum
> ! pg_get_viewdef_ext(PG_FUNCTION_ARGS)
> {
> /* By OID */
> Oid viewoid = PG_GETARG_OID(0);
> --- 337,343 ----
>
>
> Datum
> ! pg_get_viewdef_pp(PG_FUNCTION_ARGS)
> {
> /* By OID */
> Oid viewoid = PG_GETARG_OID(0);
> ***************
> *** 369,375 ****
>
>
> Datum
> ! pg_get_viewdef_name_ext(PG_FUNCTION_ARGS)
> {
> /* By qualified name */
> text *viewname = PG_GETARG_TEXT_P(0);
> --- 369,375 ----
>
>
> Datum
> ! pg_get_viewdef_name_pp(PG_FUNCTION_ARGS)
> {
> /* By qualified name */
> text *viewname = PG_GETARG_TEXT_P(0);
> ***************
> *** 630,636 ****
> }
>
> Datum
> ! pg_get_indexdef_ext(PG_FUNCTION_ARGS)
> {
> Oid indexrelid = PG_GETARG_OID(0);
> int32 colno = PG_GETARG_INT32(1);
> --- 630,636 ----
> }
>
> Datum
> ! pg_get_indexdef_pp(PG_FUNCTION_ARGS)
> {
> Oid indexrelid = PG_GETARG_OID(0);
> int32 colno = PG_GETARG_INT32(1);
> ***************
> *** 856,862 ****
> }
>
> Datum
> ! pg_get_constraintdef_ext(PG_FUNCTION_ARGS)
> {
> Oid constraintId = PG_GETARG_OID(0);
> bool pretty = PG_GETARG_BOOL(1);
> --- 856,862 ----
> }
>
> Datum
> ! pg_get_constraintdef_pp(PG_FUNCTION_ARGS)
> {
> Oid constraintId = PG_GETARG_OID(0);
> bool pretty = PG_GETARG_BOOL(1);
> ***************
> *** 1175,1181 ****
> }
>
> Datum
> ! pg_get_expr_ext(PG_FUNCTION_ARGS)
> {
> text *expr = PG_GETARG_TEXT_P(0);
> Oid relid = PG_GETARG_OID(1);
> --- 1175,1181 ----
> }
>
> Datum
> ! pg_get_expr_pp(PG_FUNCTION_ARGS)
> {
> text *expr = PG_GETARG_TEXT_P(0);
> Oid relid = PG_GETARG_OID(1);
> Index: src/include/catalog/pg_proc.h
> ===================================================================
> RCS file: /cvsroot/pgsql-server/src/include/catalog/pg_proc.h,v
> retrieving revision 1.310
> diff -c -c -r1.310 pg_proc.h
> *** src/include/catalog/pg_proc.h 30 Jul 2003 22:56:24 -0000 1.310
> --- src/include/catalog/pg_proc.h 31 Jul 2003 04:48:40 -0000
> ***************
> *** 3406,3422 ****
> DESCR("I/O");
>
> /* System-view support functions with pretty-print option */
> ! DATA(insert OID = 2504 ( pg_get_ruledef PGNSP PGUID 12 f f t f s 2
25 "26 16" pg_get_ruledef_ext - _null_ ));
> DESCR("source text of a rule with pretty-print option");
> ! DATA(insert OID = 2505 ( pg_get_viewdef PGNSP PGUID 12 f f t f s 2
25 "25 16" pg_get_viewdef_name_ext - _null_ ));
> DESCR("select statement of a view with pretty-print option");
> ! DATA(insert OID = 2506 ( pg_get_viewdef PGNSP PGUID 12 f f t f s 2
25 "26 16" pg_get_viewdef_ext - _null_ ));
> DESCR("select statement of a view with pretty-print option");
> ! DATA(insert OID = 2507 ( pg_get_indexdef PGNSP PGUID 12 f f t f s 3
25 "26 23 16" pg_get_indexdef_ext - _null_ ));
> DESCR("index description (full create statement or single expression)
with pretty-print option");
> ! DATA(insert OID = 2508 ( pg_get_constraintdef PGNSP PGUID 12 f f t f s
2 25 "26 16" pg_get_constraintdef_ext - _null_ ));
> DESCR("constraint description with pretty-print option");
> ! DATA(insert OID = 2509 ( pg_get_expr PGNSP PGUID 12 f f t f s 3 25
"25 26 16" pg_get_expr_ext - _null_ ));
> DESCR("deparse an encoded expression with pretty-print option");
>
>
> --- 3406,3422 ----
> DESCR("I/O");
>
> /* System-view support functions with pretty-print option */
> ! DATA(insert OID = 2504 ( pg_get_ruledef PGNSP PGUID 12 f f t f s 2
25 "26 16" pg_get_ruledef_pp - _null_ ));
> DESCR("source text of a rule with pretty-print option");
> ! DATA(insert OID = 2505 ( pg_get_viewdef PGNSP PGUID 12 f f t f s 2
25 "25 16" pg_get_viewdef_name_pp - _null_ ));
> DESCR("select statement of a view with pretty-print option");
> ! DATA(insert OID = 2506 ( pg_get_viewdef PGNSP PGUID 12 f f t f s 2
25 "26 16" pg_get_viewdef_pp - _null_ ));
> DESCR("select statement of a view with pretty-print option");
> ! DATA(insert OID = 2507 ( pg_get_indexdef PGNSP PGUID 12 f f t f s 3
25 "26 23 16" pg_get_indexdef_pp - _null_ ));
> DESCR("index description (full create statement or single expression)
with pretty-print option");
> ! DATA(insert OID = 2508 ( pg_get_constraintdef PGNSP PGUID 12 f f t f s
2 25 "26 16" pg_get_constraintdef_pp - _null_ ));
> DESCR("constraint description with pretty-print option");
> ! DATA(insert OID = 2509 ( pg_get_expr PGNSP PGUID 12 f f t f s 3 25
"25 26 16" pg_get_expr_pp - _null_ ));
> DESCR("deparse an encoded expression with pretty-print option");
>
>
> Index: src/include/utils/builtins.h
> ===================================================================
> RCS file: /cvsroot/pgsql-server/src/include/utils/builtins.h,v
> retrieving revision 1.224
> diff -c -c -r1.224 builtins.h
> *** src/include/utils/builtins.h 30 Jul 2003 22:56:24 -0000 1.224
> --- src/include/utils/builtins.h 31 Jul 2003 04:48:41 -0000
> ***************
> *** 441,459 ****
>
> /* ruleutils.c */
> extern Datum pg_get_ruledef(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_ruledef_ext(PG_FUNCTION_ARGS);
> extern Datum pg_get_viewdef(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_viewdef_ext(PG_FUNCTION_ARGS);
> extern Datum pg_get_viewdef_name(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_viewdef_name_ext(PG_FUNCTION_ARGS);
> extern Datum pg_get_indexdef(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_indexdef_ext(PG_FUNCTION_ARGS);
> extern Datum pg_get_triggerdef(PG_FUNCTION_ARGS);
> extern Datum pg_get_constraintdef(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_constraintdef_ext(PG_FUNCTION_ARGS);
> extern Datum pg_get_userbyid(PG_FUNCTION_ARGS);
> extern Datum pg_get_expr(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_expr_ext(PG_FUNCTION_ARGS);
> extern char *deparse_expression(Node *expr, List *dpcontext,
> bool forceprefix, bool showimplicit);
> extern List *deparse_context_for(const char *aliasname, Oid relid);
> --- 441,459 ----
>
> /* ruleutils.c */
> extern Datum pg_get_ruledef(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_ruledef_pp(PG_FUNCTION_ARGS);
> extern Datum pg_get_viewdef(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_viewdef_pp(PG_FUNCTION_ARGS);
> extern Datum pg_get_viewdef_name(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_viewdef_name_pp(PG_FUNCTION_ARGS);
> extern Datum pg_get_indexdef(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_indexdef_pp(PG_FUNCTION_ARGS);
> extern Datum pg_get_triggerdef(PG_FUNCTION_ARGS);
> extern Datum pg_get_constraintdef(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_constraintdef_pp(PG_FUNCTION_ARGS);
> extern Datum pg_get_userbyid(PG_FUNCTION_ARGS);
> extern Datum pg_get_expr(PG_FUNCTION_ARGS);
> ! extern Datum pg_get_expr_pp(PG_FUNCTION_ARGS);
> extern char *deparse_expression(Node *expr, List *dpcontext,
> bool forceprefix, bool showimplicit);
> extern List *deparse_context_for(const char *aliasname, Oid relid);
>

----------------------------------------------------------------------------
----

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-07-31 05:20:23 Re: updateable cursors
Previous Message Bruce Momjian 2003-07-31 04:57:00 Re: ruleutils with pretty-print option