Re: deparsing utility commands - Mailing list pgsql-hackers

From Andres Freund
Subject Re: deparsing utility commands
Date
Msg-id 20150222152540.GE21496@awork2.anarazel.de
Whole thread Raw
In response to Re: deparsing utility commands  (Andres Freund <andres@2ndquadrant.com>)
List 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

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Replication identifiers, take 4
Next
From: Amit Kapila
Date:
Subject: Re: Allow "snapshot too old" error, to prevent bloat