Re: creating extension including dependencies

From: Petr Jelinek <petr(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: creating extension including dependencies
Date: 2015-09-07 18:56:50
Message-ID: 55EDDDF2.7090202@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-09-02 17:31, Andres Freund wrote:
> On 2015-09-02 17:27:38 +0200, Andres Freund wrote:
>> 1) Passing the list of parents through the cascade DefElem strikes me as
>> incredibly ugly.
>>
>> For one the cascade option really should take a true/false type option
>> on the C level (so you can do defGetBoolean()), for another passing
>> through the list of parents via DefElem->arg seems wrong. You're
>> supposed to be able to copy parsenodes and at the very least that's
>> broken by the approach.
>
> I think the fix here is to split off the bulk of CreateExtension() into
> an internal function that takes additional parameters.
>

Yes that sounds cleaner. Just as a side note, List is a Node and does
have copy support (and we pass List as DefElem->arg from gram.y in
several places).

> 2) I don't like the control flow around the schema selection.
>
> It seems to be getting a bit arcane. How about instead moving the
> "extension \"%s\" must be installed in schema \"%s\" check into the if
> (control->schema != NULL) block and check for d_schema after it? That
> should look cleaner.
>

I did something like that in one of the revisions, the complaint there
was that it changes order of errors you get in situation when the schema
is not the same as the one in control file and it also does not exist.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-09-07 19:01:23 Re: creating extension including dependencies
Previous Message Alexander Korotkov 2015-09-07 18:56:47 Re: WIP: Rework access method interface