Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-07 Thread Magnus Hagander
On Tue, Dec 6, 2011 at 17:07, Tom Lane t...@sss.pgh.pa.us wrote: Magnus Hagander mag...@hagander.net 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

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-07 Thread Magnus Hagander
On Wed, Dec 7, 2011 at 10:05, Magnus Hagander mag...@hagander.net wrote: On Tue, Dec 6, 2011 at 17:07, Tom Lane t...@sss.pgh.pa.us wrote: Magnus Hagander mag...@hagander.net writes: There is some nice precedent in the CREATE TABLESPACE command (though dependent on HAVE_SYMLINK and not

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Magnus Hagander
On Sun, Dec 4, 2011 at 18:07, Tom Lane t...@sss.pgh.pa.us wrote: Andrew Dunstan and...@dunslane.net 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

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Tom Lane
Magnus Hagander mag...@hagander.net 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

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Tom Lane
Magnus Hagander mag...@hagander.net 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

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Magnus Hagander
On Tue, Dec 6, 2011 at 16:12, Tom Lane t...@sss.pgh.pa.us wrote: Magnus Hagander mag...@hagander.net 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

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Tom Lane
Magnus Hagander mag...@hagander.net 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

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Magnus Hagander
On Tue, Dec 6, 2011 at 16:17, Tom Lane t...@sss.pgh.pa.us wrote: Magnus Hagander mag...@hagander.net 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

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-06 Thread Tom Lane
Magnus Hagander mag...@hagander.net 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

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-04 Thread Magnus Hagander
On Sun, Dec 4, 2011 at 17:12, Bruce Momjian br...@momjian.us wrote: Magnus Hagander wrote: On Sun, Dec 4, 2011 at 00:43, Bruce Momjian br...@momjian.us 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

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-04 Thread Tom Lane
Magnus Hagander mag...@hagander.net 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,

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-04 Thread Magnus Hagander
On Sun, Dec 4, 2011 at 17:41, Tom Lane t...@sss.pgh.pa.us wrote: Magnus Hagander mag...@hagander.net 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

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

Re: [HACKERS] [DOCS] Moving tablespaces

2011-12-04 Thread Tom Lane
Andrew Dunstan and...@dunslane.net 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