Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-07 Thread Magnus Hagander
On Wed, Dec 7, 2011 at 10:05, Magnus Hagander wrote: > On Tue, Dec 6, 2011 at 17:07, Tom Lane wrote: >> Magnus Hagander writes: >>> There is some nice precedent in the CREATE TABLESPACE command (though >>> dependent on HAVE_SYMLINK and not HAVE_READLINK), so I'm just going to >>> copy the error

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-07 Thread Magnus Hagander
On Tue, Dec 6, 2011 at 17:07, Tom Lane wrote: > Magnus Hagander writes: >> There is some nice precedent in the CREATE TABLESPACE command (though >> dependent on HAVE_SYMLINK and not HAVE_READLINK), so I'm just going to >> copy the error message from there. > > Fair enough. > > Looking at the exis

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Tom Lane
Magnus Hagander writes: > There is some nice precedent in the CREATE TABLESPACE command (though > dependent on HAVE_SYMLINK and not HAVE_READLINK), so I'm just going to > copy the error message from there. Fair enough. Looking at the existing readlink use in port/exec.c, it strikes me that anoth

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Magnus Hagander
On Tue, Dec 6, 2011 at 16:17, Tom Lane wrote: > Magnus Hagander writes: >> Throwing an error seems a lot more safe in this case than just >> returning NULL. Since it's a situtation that really shouldn't happen. >> Maybe an assert, but I think a regular ereport(ERROR) would be the >> best. > > Not

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Tom Lane
Magnus Hagander writes: > Throwing an error seems a lot more safe in this case than just > returning NULL. Since it's a situtation that really shouldn't happen. > Maybe an assert, but I think a regular ereport(ERROR) would be the > best. Not an assert, since it's trivially user-triggerable.

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Magnus Hagander
On Tue, Dec 6, 2011 at 16:12, Tom Lane wrote: > Magnus Hagander writes: >> AFAICT, it should be as simple as the attached. > > Oh, one other thought is that the function body has to be > conditionalized on HAVE_READLINK (the fact that you forgot that > somewhere else isn't an excuse for not doing

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Tom Lane
Magnus Hagander writes: > AFAICT, it should be as simple as the attached. Oh, one other thought is that the function body has to be conditionalized on HAVE_READLINK (the fact that you forgot that somewhere else isn't an excuse for not doing it here). IIRC, only the two built-in tablespaces can e

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Tom Lane
Magnus Hagander writes: > + snprintf(sourcepath, sizeof(sourcepath), "pg_tblspc/%d", tablespaceOid); %u for an OID, please. Otherwise seems reasonably sane on first glance. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To m

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Magnus Hagander
On Sun, Dec 4, 2011 at 18:07, Tom Lane wrote: > Andrew Dunstan writes: >> On 12/04/2011 11:41 AM, Tom Lane wrote: >>> Hm, how portable is symlink-reading?  If we can actually do that >>> without big headaches, then +1. > >> I wondered that, specifically about Windows junction points, but we seem

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-04 Thread Tom Lane
Andrew Dunstan writes: > On 12/04/2011 11:41 AM, Tom Lane wrote: >> Hm, how portable is symlink-reading? If we can actually do that >> without big headaches, then +1. > I wondered that, specifically about Windows junction points, but we seem > to have support for it already in dirmod.c::pgreadl

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-04 Thread Andrew Dunstan
On 12/04/2011 11:41 AM, Tom Lane wrote: 1) Remove the column. Rely on the symlink. Create a pg_get_tablespace_location(oid) function, that could be used by pg_dumpall and friends, that just reads the symlink. Hm, how portable is symlink-reading? If we can actually do that without big headac

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-04 Thread Magnus Hagander
On Sun, Dec 4, 2011 at 17:41, Tom Lane wrote: > Magnus Hagander writes: >> And IIRC, we don't actually *use* spclocation anywhere. > > Just for pg_dump, I think. pg_dumpall :-) It's also used in pg_upgrade and pg_basebackup, but those are easily dealt with if we define a function for it. >> H

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-04 Thread Tom Lane
Magnus Hagander writes: > And IIRC, we don't actually *use* spclocation anywhere. Just for pg_dump, I think. > How about we > just get rid of them as independents? We could either: > 1) Remove the column. Rely on the symlink. Create a > pg_get_tablespace_location(oid) function, that could be us

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-04 Thread Magnus Hagander
On Sun, Dec 4, 2011 at 17:12, Bruce Momjian wrote: > Magnus Hagander wrote: >> On Sun, Dec 4, 2011 at 00:43, Bruce Momjian wrote: >> > Do we have any documentation about how to move a tablespace to a new >> > directory? ?If not, I think we should write some. >> >> Do we have any support for doing