Re: pg_tablespace_location() error message

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_tablespace_location() error message
Date: 2012-04-11 00:11:42
Message-ID: 20120411001142.GK3379@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 10, 2012 at 07:57:30PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > On Tue, Apr 10, 2012 at 07:09:33PM -0400, Tom Lane wrote:
> >> Hm. I have no objection to special-casing zero here, but what behavior
> >> do you want? Should it return an empty string as we do for
> >> DEFAULTTABLESPACE_OID, or throw a different error?
>
> > I have no idea. The big problem is that we currently use '' for the
> > cluster default, while 0 means the database default. I can't think of a
> > good return result --- I think it has to be an error of some kind.
>
> 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.

> Alternatively, we could expect pg_upgrade to understand that and make
> the substitution itself, but if the same would be needed by most uses of
> the function, maybe we should just do it here.

I just applied a patch to pg_upgrade to do exactly that, and it is
needed in pre-9.2 as well because pg_upgrade was testing for an empty
spclocation, which could be '' or it could be NULL (from an outer join),
but pg_upgrade wasn't distinguising the two. :-(

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2012-04-11 00:12:38 Re: Last gasp
Previous Message Bruce Momjian 2012-04-11 00:05:22 Re: pg_upgrade incorrectly equates pg_default and database tablespace