On Tue, Apr 10, 2012 at 08:22:15PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > On Tue, Apr 10, 2012 at 07:57:30PM -0400, Tom Lane wrote:
> >> If we expect this function to mainly be applied to pg_class.reltablespace,
> >> then it seems like it ought to understand that zero means "the database
> >> default" and substitute the database's default tablespace. That might
> >> or might not be the same as the cluster default.
>
> > Well, do we really want to be reporting the _current_ data directory
> > location? We do track tablespace symlink moves because we read the
> > symlinks now, so that isn't out of the question. A bigger question is
> > whether returning '' for a database-default location is valid --- I am
> > thinking no.
>
> Well, the point is that we should return that for the *cluster* default
> tablespace (mainly because we have nothing better available). But the
> database default might or might not be the cluster default.
Right. The complexity is that in our pre-9.2 pg_tablespace, spclocation
of '' means cluster default, and no row pg_tablespace row (0) meant
db-default. The fact that pg_tablespace_location() returns '' for
cluster default could be called an bug, or not. ;-)
I think the functions purpose is just different from what pg_tablespace
did -- the function returns the symlink location, so '' for cluster
default seems fine because there is no symlink.
-- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB
http://enterprisedb.com
+ It's impossible for everything to be true. +