Re: deparsing utility commands

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: deparsing utility commands
Date: 2015-02-22 15:25:40
Message-ID: 20150222152540.GE21496@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-02-21 17:30:24 +0100, Andres Freund wrote:

> > /*
> > + * deparse_CreateFunctionStmt
> > + * Deparse a CreateFunctionStmt (CREATE FUNCTION)
> > + *
> > + * Given a function OID and the parsetree that created it, return the JSON
> > + * blob representing the creation command.
> > + *
> > + * XXX this is missing the per-function custom-GUC thing.
> > + */

> > Subject: [PATCH 27/42] deparse: Support ALTER FUNCTION
>
> > + * deparse_AlterFunctionStmt
> > + * Deparse a AlterFunctionStmt (ALTER FUNCTION)
> > + *
> > + * Given a function OID and the parsetree that created it, return the JSON
> > + * blob representing the alter command.
> > + *
> > + * XXX this is missing the per-function custom-GUC thing.
> > + */
>
> Hm, so my earlier ptatch needs to partially be copied here. I'm running out of time now though...

Updated 0003 attached that supports both SET for both CREATE and
ALTER. In my previous patch I'd looked at proconfig for the values. A
bit further thought revealed that that's not such a great idea: It works
well enough for CREATE FUNCTION, but already breaks down at CREATE OR
REPLACE FUNCTION unless we want to emit RESET ALL (SET ...)+ which seems
mighty ugly.

Also, the code is actually a good bit easier to understand this
way. I. hate. arrays. ;)

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0003-Support-SET-RESET-in-CREATE-ALTER-FUNCTION.patch text/x-patch 3.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2015-02-22 15:34:56 Re: Allow "snapshot too old" error, to prevent bloat
Previous Message Andres Freund 2015-02-22 15:12:34 Re: Replication identifiers, take 4