Thread: [PATCH] Store Extension Options

[PATCH] Store Extension Options

From
Fabrízio de Royes Mello
Date:
Hi all,

The main goal of this patch is enable to an user the capability to store options
(relations and attributes) related to extensions by using a fixed prefix called 'ext' in
the defined name. It's cant be useful for replication solutions.

So, with this patch we can do that:

ALTER TABLE foo
   SET (ext.somext.do_replicate=true);

When 'ext' is the fixed prefix, 'somext' is the extension name, 'do_replicate' is the
extension option and 'true' is the value.
 
Also we can use this form to define storage options to indexes and per-attribute
options.


Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
Attachment

Re: [PATCH] Store Extension Options

From
Robert Haas
Date:
On Wed, Nov 20, 2013 at 1:52 PM, Fabrízio de Royes Mello
<fabriziomello@gmail.com> wrote:
> The main goal of this patch is enable to an user the capability to store
> options
> (relations and attributes) related to extensions by using a fixed prefix
> called 'ext' in
> the defined name. It's cant be useful for replication solutions.
>
> So, with this patch we can do that:
>
> ALTER TABLE foo
>    SET (ext.somext.do_replicate=true);
>
> When 'ext' is the fixed prefix, 'somext' is the extension name,
> 'do_replicate' is the
> extension option and 'true' is the value.

This doesn't seem like a particular good choice of syntax; and I also
have my doubts about the usefulness of the feature.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: [PATCH] Store Extension Options

From
Fabrízio de Royes Mello
Date:
<div dir="ltr"><div class="gmail_extra"><br />On Thu, Nov 21, 2013 at 12:05 AM, Robert Haas <<a
href="mailto:robertmhaas@gmail.com">robertmhaas@gmail.com</a>>wrote:<br />><br />> On Wed, Nov 20, 2013 at
1:52PM, Fabrízio de Royes Mello<br /> > <<a href="mailto:fabriziomello@gmail.com">fabriziomello@gmail.com</a>>
wrote:<br/>> > The main goal of this patch is enable to an user the capability to store<br />> > options<br
/>>> (relations and attributes) related to extensions by using a fixed prefix<br /> > > called 'ext' in<br
/>>> the defined name. It's cant be useful for replication solutions.<br />> ><br />> > So, with this
patchwe can do that:<br />> ><br />> > ALTER TABLE foo<br /> > >    SET
(ext.somext.do_replicate=true);<br/>> ><br />> > When 'ext' is the fixed prefix, 'somext' is the extension
name,<br/>> > 'do_replicate' is the<br />> > extension option and 'true' is the value.<br /> ><br />>
Thisdoesn't seem like a particular good choice of syntax; <br /><br /></div><div class="gmail_extra">What's your syntax
suggestion?<br/></div><div class="gmail_extra"><br /><br />> and I also have my doubts about the usefulness of the
feature.<br/> ><br /><br /></div><div class="gmail_extra">This feature can be used for replication solutions, but
alsocan be used for any extension that need do some specific configuration about tables, attributes and/or indexes.<br
/></div><divclass="gmail_extra"><br /></div><div class="gmail_extra">Regards,<br /><br /></div><div
class="gmail_extra">--<br/>Fabrízio de Royes Mello<br />Consultoria/Coaching PostgreSQL<br />>> Timbira: <a
href="http://www.timbira.com.br">http://www.timbira.com.br</a><br/> >> Blog sobre TI: <a
href="http://fabriziomello.blogspot.com">http://fabriziomello.blogspot.com</a><br/>>> Perfil Linkedin: <a
href="http://br.linkedin.com/in/fabriziomello">http://br.linkedin.com/in/fabriziomello</a><br/> >> Twitter: <a
href="http://twitter.com/fabriziomello">http://twitter.com/fabriziomello</a></div></div>

Re: [PATCH] Store Extension Options

From
Robert Haas
Date:
On Wed, Nov 20, 2013 at 9:35 PM, Fabrízio de Royes Mello
<fabriziomello@gmail.com> wrote:
>> > So, with this patch we can do that:
>> >
>> > ALTER TABLE foo
>> >    SET (ext.somext.do_replicate=true);
>> >
>> > When 'ext' is the fixed prefix, 'somext' is the extension name,
>> > 'do_replicate' is the
>> > extension option and 'true' is the value.
>>
>> This doesn't seem like a particular good choice of syntax;
>
> What's your syntax suggestion?

I dunno, but I doubt that hardcoding ext as an abbreviation for
extension is a good decision.  I also doubt that any fixed prefix is a
good decision.

>> and I also have my doubts about the usefulness of the feature.
>
> This feature can be used for replication solutions, but also can be used for
> any extension that need do some specific configuration about tables,
> attributes and/or indexes.

So, create your own configuration table with a column of type regclass.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: [PATCH] Store Extension Options

From
Fabrízio de Royes Mello
Date:
On Thu, Nov 21, 2013 at 11:06 AM, Robert Haas <robertmhaas@gmail.com> wrote:
>
> On Wed, Nov 20, 2013 at 9:35 PM, Fabrízio de Royes Mello
> <fabriziomello@gmail.com> wrote:
> >> > So, with this patch we can do that:
> >> >
> >> > ALTER TABLE foo
> >> >    SET (ext.somext.do_replicate=true);
> >> >
> >> > When 'ext' is the fixed prefix, 'somext' is the extension name,
> >> > 'do_replicate' is the
> >> > extension option and 'true' is the value.
> >>
> >> This doesn't seem like a particular good choice of syntax;
> >
> > What's your syntax suggestion?
>
> I dunno, but I doubt that hardcoding ext as an abbreviation for
> extension is a good decision.  I also doubt that any fixed prefix is a
> good decision.
>

I use this form to simplify implementation and not change sql syntax, but we can discuss another way or syntax.


> >> and I also have my doubts about the usefulness of the feature.
> >
> > This feature can be used for replication solutions, but also can be used for
> > any extension that need do some specific configuration about tables,
> > attributes and/or indexes.
>
> So, create your own configuration table with a column of type regclass.
>

This can be a solution, but with a config table we have some problems:
a) no dependency tracking (pg_depend)
b) no correct locking
c) no relcache
d) harder to do correctly for columns

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello