Skip site navigation (1) Skip section navigation (2)

Re: Disable alternate locations on Win32

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Disable alternate locations on Win32
Date: 2003-05-07 03:51:32
Message-ID: 200305070351.h473pXZ29600@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > The following patch disables alternate locations on Win32 because it
> > > doesn't have symlinks.
> > 
> > Why not do it with one ifdef in one place?
> 
> It was done this way because they wanted to test earlier for failure,
> and they didn't want the symlink call because they didn't have symlinks.
> I didn't totally follow the code.

I checked this again and the test is at the top, while the symlink()
call is at the bottom after the database has already been copied.  I
think we do need to error out before we start copying the database.

> >   	if (alt_loc)
> >   	{
> > + #ifndef WIN32
> >   		if (symlink(alt_loc, nominal_loc) != 0)
> >   			elog(ERROR, "CREATE DATABASE: could not link '%s' to '%s': %m",
> >   				 nominal_loc, alt_loc);
> > + #else
> > + 		elog(ERROR, "CREATE DATABASE: may not use an alternate location on this platform");
> > + #endif
> >   	}
> > 
> > Also I wonder if this shouldn't be conditionalized on something like
> > HAVE_SYMLINKS rather than a hardwired platform check.
> 
> Yes, that would be better.

OK, here is an applied patch that tests for symlink() rather than WIN32.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-patches by date

Next:From: Tom LaneDate: 2003-05-07 04:11:56
Subject: Re: Disable alternate locations on Win32
Previous:From: Bruce MomjianDate: 2003-05-06 23:35:09
Subject: Re: Global variables in exec()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group