Re: Finer Extension dependencies - Mailing list pgsql-hackers

From Hitoshi Harada
Subject Re: Finer Extension dependencies
Date
Msg-id CAP7QgmnrufDk9b-eTaU1Ei64U69m+PbtcJ3f3HTu80xzCB_DHQ@mail.gmail.com
Whole thread Raw
In response to Finer Extension dependencies  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
Responses Re: Finer Extension dependencies  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
List pgsql-hackers
On Sun, Dec 18, 2011 at 6:36 AM, Dimitri Fontaine
<dimitri@2ndquadrant.fr> wrote:
> Hi,
>
> The extensions work we began in 9.1 is not yet finished entirely
> (*cough*), so I'm opening a new patch series here by attacking the
> dependency problems.
>
> Some people want us to manage extension version numbers with sorting
> semantics so that we are able to depend on foo >= 1.2 and crazy things
> like this, and I think the need is reasonable and easier than that to
> address.

The patch applies with one reject, which I could fix easily. The make
check passed.

extension-provides.v1.patch  extensions.docx
haradh1-mac:postgresql-head haradh1$ patch -p1 <
~/Downloads/extension-provides.v1.patch
patching file contrib/pg_upgrade_support/pg_upgrade_support.c
patching file doc/src/sgml/catalogs.sgml
Hunk #2 succeeded at 3063 (offset 11 lines).
Hunk #3 succeeded at 6865 (offset 11 lines).
patching file doc/src/sgml/extend.sgml
patching file src/backend/catalog/Makefile
patching file src/backend/catalog/dependency.c
patching file src/backend/catalog/system_views.sql
patching file src/backend/commands/extension.c
patching file src/include/catalog/dependency.h
patching file src/include/catalog/indexing.h
patching file src/include/catalog/pg_extension_feature.h
patching file src/include/catalog/pg_proc.h
Hunk #1 succeeded at 4341 (offset 25 lines).
patching file src/include/commands/extension.h
patching file src/test/regress/expected/rules.out
patching file src/test/regress/expected/sanity_check.out
Hunk #1 succeeded at 103 (offset 1 line).
Hunk #2 FAILED at 163.
1 out of 2 hunks FAILED -- saving rejects to file
src/test/regress/expected/sanity_check.out.rej

What this patch does is basically:
- add pg_extension_feature to store "feature" (name) provided by extensions
- extension control file now has "provide" parameter to indicate
"feature", which is comma separated
- when creating an extension, the backend looks for "feature" required
in control file
- the installed extension has dependency on "feature"

So, the first thing is catalog.

db1=# \d pg_extension_feature;
Table "pg_catalog.pg_extension_feature"  Column   | Type | Modifiers
------------+------+-----------extoid     | oid  | not nullextfeature | name | not null
Indexes:   "pg_extension_feature_index" UNIQUE, btree (extoid, extfeature)   "pg_extension_feature_oid_index" UNIQUE,
btree(oid)
 

* I'm not quit sure why pg_extension_feature_index needs extoid column.
* I have a big question to add two-column catalog. I don't mind the
actual number of columns, but if the table has only two columns, it
implies the design may be bad. Only two column catalog other than this
is pg_largeobject_metadata.

Next, some questions:
- Why is the finer dependency needed? Do you have tangible example
that struggles with the dependency granularity? I feel so good about
the existing dependency on extension as an extension developer of
several ones.
- What happens if DROP EXTENSION ... CASCADE? Does it work?
- How does pg_upgrade interact with this? The dependency changes.

A minor memo.
list_extension_features(): I guess the size argument for repalloc is bogus.

So, that's pretty much I've reviewed quickly. I'll need more time to
look in detail, but I'd like more inputs for the high-level design and
direction.

Thanks,
-- 
Hitoshi Harada


pgsql-hackers by date:

Previous
From: "Erik Rijkers"
Date:
Subject: Re: WIP: index support for regexp search
Next
From: Kääriäinen Anssi
Date:
Subject: Re: REVIEW: pg_stat_statements with query tree based normalization