Thread

Commits

  1. Hide duplicate names from extension views

  1. Only one version can be installed when using extension_control_path

    Pierrick <pierrick.chovelon@dalibo.com> — 2025-09-05T14:22:14Z

    If the same extension is in two different paths mentioned in 
    extension_control_path,
    it is impossible to install the version of the last one.
    
    postgres=# show extension_control_path ;
                                extension_control_path
    -----------------------------------------------------------------------------
      $system:/extensions/meilleureextension/share:/extensions/monextension/share
    (1 row)
    
    postgres=# select * from pg_available_extensions where name like '%mon%';
          name     | default_version | installed_version |    comment
    --------------+-----------------+-------------------+---------------
      monextension | 2.0             |                   | Meilleure
      monextension | 1.0             |                   | Mon extension
    
    (2 rows)
    
    postgres=# create extension monextension version "1.0" ;
    ERROR:  extension "monextension" has no installation script nor update path for version "1.0"
    
    postgres=# create extension monextension ;
    CREATE EXTENSION
    postgres=# select * from pg_available_extensions where name like '%mon%';
          name     | default_version | installed_version |    comment
    --------------+-----------------+-------------------+---------------
      monextension | 2.0             | 2.0               | Meilleure
      monextension | 1.0             | 2.0               | Mon extension
    
    
    Don't you think that the command
    
    create extension monextension version "1.0" ;
    
    should be accepted by checking in all paths ?
    
    Pierrick,
    
    
    
  2. Re: Only one version can be installed when using extension_control_path

    Matheus Alcantara <matheusssilv97@gmail.com> — 2025-09-08T15:05:16Z

    On Fri Sep 5, 2025 at 11:22 AM -03, Pierrick wrote:
    > If the same extension is in two different paths mentioned in 
    > extension_control_path,
    > it is impossible to install the version of the last one.
    >
    > postgres=# show extension_control_path ;
    >                             extension_control_path
    > -----------------------------------------------------------------------------
    >   $system:/extensions/meilleureextension/share:/extensions/monextension/share
    > (1 row)
    >
    > postgres=# select * from pg_available_extensions where name like '%mon%';
    >       name     | default_version | installed_version |    comment
    > --------------+-----------------+-------------------+---------------
    >   monextension | 2.0             |                   | Meilleure
    >   monextension | 1.0             |                   | Mon extension
    >
    > (2 rows)
    >
    > postgres=# create extension monextension version "1.0" ;
    > ERROR:  extension "monextension" has no installation script nor update path for version "1.0"
    >
    > postgres=# create extension monextension ;
    > CREATE EXTENSION
    > postgres=# select * from pg_available_extensions where name like '%mon%';
    >       name     | default_version | installed_version |    comment
    > --------------+-----------------+-------------------+---------------
    >   monextension | 2.0             | 2.0               | Meilleure
    >   monextension | 1.0             | 2.0               | Mon extension
    >
    >
    > Don't you think that the command
    >
    > create extension monextension version "1.0" ;
    >
    > should be accepted by checking in all paths ?
    >
    This is working as expected. The current behavior is that at the first
    step of CREATE EXTENSION command it will try to find the primary
    .control file of the extension. On this step it will search the .control
    file on paths at extension_control_path in order and it will use the
    first one that it finds and based on the .control file found it will
    install the extension using the version specified on the command. 
    
    --
    Matheus Alcantara
    
    
    
    
    
  3. Re: Only one version can be installed when using extension_control_path

    David G. Johnston <david.g.johnston@gmail.com> — 2025-09-08T15:23:03Z

    On Monday, September 8, 2025, Matheus Alcantara <matheusssilv97@gmail.com>
    wrote:
    
    > On Fri Sep 5, 2025 at 11:22 AM -03, Pierrick wrote:
    > > If the same extension is in two different paths mentioned in
    > > extension_control_path,
    > > it is impossible to install the version of the last one.
    > >
    > > postgres=# show extension_control_path ;
    > >                             extension_control_path
    > > ------------------------------------------------------------
    > -----------------
    > >   $system:/extensions/meilleureextension/share:/
    > extensions/monextension/share
    > > (1 row)
    > >
    > > postgres=# select * from pg_available_extensions where name like '%mon%';
    > >       name     | default_version | installed_version |    comment
    > > --------------+-----------------+-------------------+---------------
    > >   monextension | 2.0             |                   | Meilleure
    > >   monextension | 1.0             |                   | Mon extension
    > >
    >
    
    
    > On this step it will search the .control
    > file on paths at extension_control_path in order and it will use the
    > first one that it finds and based on the .control file found it will
    > install the extension using the version specified on the command.
    >
    
    Then pg_available_extensions seems broken - it lists extensions as
    available that are not accessible to the user due to this policy.  Maybe we
    need to add something indicating that certain rows are hidden behind the
    present path setting which would need to be changed if one wishes to
    install them.  Also seems like the extension location should be part of the
    output too.
    
    David J.
    
  4. Re: Only one version can be installed when using extension_control_path

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-09-08T15:35:42Z

    "David G. Johnston" <david.g.johnston@gmail.com> writes:
    > On Monday, September 8, 2025, Matheus Alcantara <matheusssilv97@gmail.com>
    > wrote:
    >> On this step it will search the .control
    >> file on paths at extension_control_path in order and it will use the
    >> first one that it finds and based on the .control file found it will
    >> install the extension using the version specified on the command.
    
    > Then pg_available_extensions seems broken - it lists extensions as
    > available that are not accessible to the user due to this policy.  Maybe we
    > need to add something indicating that certain rows are hidden behind the
    > present path setting which would need to be changed if one wishes to
    > install them.  Also seems like the extension location should be part of the
    > output too.
    
    Between this and previously-identified problems (commits 81eaaa2c4,
    f777d7738), it seems clear that extension_control_path (which is a new
    thing in v18) was very poorly thought out.  I wonder if it's too late
    to revert it so that we can redesign it more carefully.
    
    			regards, tom lane
    
    
    
    
  5. Re: Only one version can be installed when using extension_control_path

    Pierrick <pierrick.chovelon@dalibo.com> — 2025-09-09T07:53:44Z

    On 08/09/2025 17:35, Tom Lane wrote:
    > "David G. Johnston" <david.g.johnston@gmail.com> writes:
    >> On Monday, September 8, 2025, Matheus Alcantara <matheusssilv97@gmail.com>
    >> wrote:
    >>> On this step it will search the .control
    >>> file on paths at extension_control_path in order and it will use the
    >>> first one that it finds and based on the .control file found it will
    >>> install the extension using the version specified on the command.
    >> Then pg_available_extensions seems broken - it lists extensions as
    >> available that are not accessible to the user due to this policy.  Maybe we
    >> need to add something indicating that certain rows are hidden behind the
    >> present path setting which would need to be changed if one wishes to
    >> install them.  Also seems like the extension location should be part of the
    >> output too.
    
    I agree. If an extension is the list, I expect to be able to install it.
    
    Either :
    - we hide the latest version found in paths in pg_available_extensions ;
    - we give the possibility to install all listed versions.
    The second option seems more relevant to me.
    
    Adding extension location is a good idea.
    
    > Between this and previously-identified problems (commits 81eaaa2c4,
    > f777d7738), it seems clear that extension_control_path (which is a new
    > thing in v18) was very poorly thought out.  I wonder if it's too late
    > to revert it so that we can redesign it more carefully.
    >
    > 			regards, tom lane
    
    
    
    
  6. Re: Only one version can be installed when using extension_control_path

    Matheus Alcantara <matheusssilv97@gmail.com> — 2025-09-09T14:18:09Z

    On Tue Sep 9, 2025 at 4:53 AM -03, Pierrick wrote:
    >
    > On 08/09/2025 17:35, Tom Lane wrote:
    >> "David G. Johnston" <david.g.johnston@gmail.com> writes:
    >>> On Monday, September 8, 2025, Matheus Alcantara <matheusssilv97@gmail.com>
    >>> wrote:
    >>>> On this step it will search the .control
    >>>> file on paths at extension_control_path in order and it will use the
    >>>> first one that it finds and based on the .control file found it will
    >>>> install the extension using the version specified on the command.
    >>> Then pg_available_extensions seems broken - it lists extensions as
    >>> available that are not accessible to the user due to this policy.  Maybe we
    >>> need to add something indicating that certain rows are hidden behind the
    >>> present path setting which would need to be changed if one wishes to
    >>> install them.  Also seems like the extension location should be part of the
    >>> output too.
    >
    > I agree. If an extension is the list, I expect to be able to install it.
    >
    I definitely agree that pg_available_extensions is wrong but I think
    that a fix for this should be to don't allow extensions with the same
    name on different paths.
    
    The current behavior is to stop the searching when the first extension
    name matches with the CREATE EXTENSION input, this works in the same way
    when for example we have the same command on multiple paths on PATH.
    Changing the behavior to search on all paths to find the extension that
    matches the name and possibly the version seems complicated and
    confusing to me TBH.
    
    To have multiple versions of the same extension, the .sql files for all
    versions should be put on the same path all together as already is
    today. Enabling adding the same extension on multiple paths doesn't seem
    right to me IMHO.
    
    Any thoughts? I'm missing something here?
    
    > Adding extension location is a good idea.
    >
    This looks like a good idea to me too.
    
    Thanks for all the comments!
    
    --
    Matheus Alcantara
    
    
    
    
  7. Re: Only one version can be installed when using extension_control_path

    Pierrick <pierrick.chovelon@dalibo.com> — 2025-09-10T07:48:40Z

    On 09/09/2025 16:18, Matheus Alcantara wrote:
    > On Tue Sep 9, 2025 at 4:53 AM -03, Pierrick wrote:
    >> On 08/09/2025 17:35, Tom Lane wrote:
    >>> "David G. Johnston"<david.g.johnston@gmail.com> writes:
    >>>> On Monday, September 8, 2025, Matheus Alcantara<matheusssilv97@gmail.com>
    >>>> wrote:
    >>>>> On this step it will search the .control
    >>>>> file on paths at extension_control_path in order and it will use the
    >>>>> first one that it finds and based on the .control file found it will
    >>>>> install the extension using the version specified on the command.
    >>>> Then pg_available_extensions seems broken - it lists extensions as
    >>>> available that are not accessible to the user due to this policy.  Maybe we
    >>>> need to add something indicating that certain rows are hidden behind the
    >>>> present path setting which would need to be changed if one wishes to
    >>>> install them.  Also seems like the extension location should be part of the
    >>>> output too.
    >> I agree. If an extension is the list, I expect to be able to install it.
    >>
    > I definitely agree that pg_available_extensions is wrong but I think
    > that a fix for this should be to don't allow extensions with the same
    > name on different paths.
    >
    > The current behavior is to stop the searching when the first extension
    > name matches with the CREATE EXTENSION input, this works in the same way
    > when for example we have the same command on multiple paths on PATH.
    
    If so, then only one line should be printed in pg_available_extensions.
    This could be the fix :).
    
    > Changing the behavior to search on all paths to find the extension that
    > matches the name and possibly the version seems complicated and
    > confusing to me TBH.
    >
    > To have multiple versions of the same extension, the .sql files for all
    > versions should be put on the same path all together as already is
    > today. Enabling adding the same extension on multiple paths doesn't seem
    > right to me IMHO.
    >
    > Any thoughts? I'm missing something here?
    
    Well, I don't really have a strong argument, but adding this new setting 
    allows
    people to work with extensions differently. Having different folders for 
    different
    versions of the same extension might be a new approach.
    
    >
    >> Adding extension location is a good idea.
    >>
    > This looks like a good idea to me too.
    >
    > Thanks for all the comments!
    You are welcome :)
    >
    > --
    > Matheus Alcantara
  8. Re: Only one version can be installed when using extension_control_path

    Michael Paquier <michael@paquier.xyz> — 2025-09-10T23:38:44Z

    On Mon, Sep 08, 2025 at 11:35:42AM -0400, Tom Lane wrote:
    > Between this and previously-identified problems (commits 81eaaa2c4,
    > f777d7738), it seems clear that extension_control_path (which is a new
    > thing in v18) was very poorly thought out.  I wonder if it's too late
    > to revert it so that we can redesign it more carefully.
    
    It would be too late once we are in GA, and we are not yet in GA.  At
    this point I think that this should be Peter's call.
    
    I am not in his shoes, still I suspect like you that we may have not
    seen the end of it yet.  If we're confident enough that we can fix
    anything, that's fine as a response to me, but discussions are also
    involving how available extensions are seen at catalog level.  This
    bit is concerning for me, but I'm also of a pessimistic nature.
    --
    Michael
    
  9. Re: Only one version can be installed when using extension_control_path

    Peter Eisentraut <peter@eisentraut.org> — 2025-09-11T14:11:43Z

    On 10.09.25 09:48, Pierrick wrote:
    > On 09/09/2025 16:18, Matheus Alcantara wrote:
    >> On Tue Sep 9, 2025 at 4:53 AM -03, Pierrick wrote:
    >>> On 08/09/2025 17:35, Tom Lane wrote:
    >>>> "David G. Johnston"<david.g.johnston@gmail.com> writes:
    >>>>> On Monday, September 8, 2025, Matheus Alcantara<matheusssilv97@gmail.com>
    >>>>> wrote:
    >>>>>> On this step it will search the .control
    >>>>>> file on paths at extension_control_path in order and it will use the
    >>>>>> first one that it finds and based on the .control file found it will
    >>>>>> install the extension using the version specified on the command.
    >>>>> Then pg_available_extensions seems broken - it lists extensions as
    >>>>> available that are not accessible to the user due to this policy.  Maybe we
    >>>>> need to add something indicating that certain rows are hidden behind the
    >>>>> present path setting which would need to be changed if one wishes to
    >>>>> install them.  Also seems like the extension location should be part of the
    >>>>> output too.
    >>> I agree. If an extension is the list, I expect to be able to install it.
    >>>
    >> I definitely agree that pg_available_extensions is wrong but I think
    >> that a fix for this should be to don't allow extensions with the same
    >> name on different paths.
    >>
    >> The current behavior is to stop the searching when the first extension
    >> name matches with the CREATE EXTENSION input, this works in the same way
    >> when for example we have the same command on multiple paths on PATH.
    > 
    > If so, then only one line should be printed in pg_available_extensions.
    > This could be the fix :).
    
    Here is a patch for that.  Please test it against your setup.
    
  10. Re: Only one version can be installed when using extension_control_path

    Pierrick <pierrick.chovelon@dalibo.com> — 2025-09-11T18:03:07Z

    On 11/09/2025 16:11, Peter Eisentraut wrote:
    >
    > Here is a patch for that.  Please test it against your setup.
    Thanks a lot. Here is a test, and IMHO, it looks good.
    
    -- version 1 of monextension is in /tmp/extensions/share/extension
    
    postgres=# show extension_control_path ;
                     extension_control_path
    ------------------------------------------------------
      $system:/tmp/extensions/share:/tmp/extensions2/share
    (1 ligne)
    
    postgres=# select * from pg_available_extensions where name = 
    'monextension';
          name     | default_version | installed_version |    comment
    --------------+-----------------+-------------------+---------------
      monextension | 1.0             |                   | Mon extension
    (1 ligne)
    
    -- switching order
    
    postgres=# alter system set extension_control_path = 
    '$system:/tmp/extensions2/share:/tmp/extensions/share';
    ALTER SYSTEM
    postgres=# select pg_reload_conf();
      pg_reload_conf
    ----------------
      t
    (1 ligne)
    
    postgres=# show extension_control_path ;
                     extension_control_path
    ------------------------------------------------------
      $system:/tmp/extensions2/share:/tmp/extensions/share
    (1 ligne)
    
    -- version 2 of monextension is in /tmp/extensions2/share/extension
    
    postgres=# select * from pg_available_extensions where name = 
    'monextension';
          name     | default_version | installed_version |    comment
    --------------+-----------------+-------------------+---------------
      monextension | 2.0             |                   | Mon extension
    (1 ligne)
    
    -- make a mistake in first folder
    
    postgres=# alter system set extension_control_path = 
    '$system:/tmp/extension_old/share:/tmp/extensions/share';
    ALTER SYSTEM
    postgres=# select pg_reload_conf();
      pg_reload_conf
    ----------------
      t
    (1 ligne)
    
    -- still version 2.0
    postgres=# select * from pg_available_extensions where name = 
    'monextension';
          name     | default_version | installed_version |    comment
    --------------+-----------------+-------------------+---------------
      monextension | 1.0             |                   | Mon extension
    (1 ligne)
    
    
    
    
    
  11. Re: Only one version can be installed when using extension_control_path

    Pierrick <pierrick.chovelon@dalibo.com> — 2025-09-11T18:05:32Z

    On 11/09/2025 20:03, Pierrick wrote:
    >
    > -- make a mistake in first folder
    >
    > postgres=# alter system set extension_control_path = 
    > '$system:/tmp/extension_old/share:/tmp/extensions/share';
    > ALTER SYSTEM
    > postgres=# select pg_reload_conf();
    >  pg_reload_conf
    > ----------------
    >  t
    > (1 ligne)
    >
    > -- still version 2.0
    sorry ... read --still version 1.0 of course
    > postgres=# select * from pg_available_extensions where name = 
    > 'monextension';
    >      name     | default_version | installed_version |    comment
    > --------------+-----------------+-------------------+---------------
    >  monextension | 1.0             |                   | Mon extension
    > (1 ligne)
    >
    
    
    
    
  12. Re: Only one version can be installed when using extension_control_path

    Peter Eisentraut <peter@eisentraut.org> — 2025-09-15T05:40:20Z

    On 11.09.25 20:03, Pierrick wrote:
    > On 11/09/2025 16:11, Peter Eisentraut wrote:
    >>
    >> Here is a patch for that.  Please test it against your setup.
    > Thanks a lot. Here is a test, and IMHO, it looks good.
    
    committed
    
    
    
    
    
  13. Re: Only one version can be installed when using extension_control_path

    Matheus Alcantara <matheusssilv97@gmail.com> — 2025-09-17T12:31:17Z

    On Mon, Sep 8, 2025 at 12:23 PM David G. Johnston
    <david.g.johnston@gmail.com> wrote:
    > Also seems like the extension location should be part of the output too.
    >
    I've posted a patch for this at [1]
    
    [1] https://www.postgresql.org/message-id/DCTSKQAVOXIG.3A05JM1YORARK%40gmail.com
    
    -- 
    Matheus Alcantara