Re: Contributing with code

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Antonio Belloni <abelloni(at)rioservice(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Contributing with code
Date: 2017-12-28 15:05:17
Message-ID: 134450fb-a780-8868-5235-1a7fe5808e09@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/27/17 15:18, Antonio Belloni wrote:
> I checked the code of pg_tablespace_databases, defined in
> src/backend/utils/adt/misc.c, and see that it uses a much simpler
> approach : It just reads the tablespaces directories and return the name
> of the directories that represents databases OIDs. 
>
> Although the function works as expected, I  can see some issues not
> addressed in the code :
>
> - It does not check for permissions. Any user can execute it;
> - It does not check if the platform supports symlinks, which can cause
> an error because the function is trying to follow the links defined in
> base/pg_tblspc.
>
> I could use the same approach and write a function that goes down one
> more level in the directory structure and find the objects' OIDs inside
> each database directory, but I don't know if this is the better way to
> do that.

The information of what object is in what tablespace already exists in
the system catalogs, so I don't think we need new ways to discover that
information. What the todo item referred to, I think, was having a way
to discover that across database boundaries. But I think that problem
is unsolvable by design, because you can't look into other databases.
Looking into the file system to discover the OIDs of objects might work,
but then you can't do anything with those OIDs without having access to
the respective database to resolve them.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-12-28 15:12:59 Re: plpgsql function startup-time improvements
Previous Message Antonio Belloni 2017-12-28 15:00:30 Re: Contributing some code