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

Re: PITR on Win32 - Archive and Restore

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: markir(at)coretech(dot)co(dot)nz
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, tgl(at)sss(dot)pgh(dot)pa(dot)us,pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: PITR on Win32 - Archive and Restore
Date: 2004-08-11 02:08:08
Message-ID: 200408110208.i7B288G08298@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers-win32pgsql-patches
OK, I would like to get a 100% solution here.  The change of / to \
really only handles part of our problem, and doesn't deal with
directories with spaces like "Program Files".

We need a 100% solution for Win32 for this.  I know we have been around
with the quote test but we need to keep going.  initdb and pg_ctl had
similar problems but we got it working 100% after some effort, and we
need to do the same here.

OK, as a data point, why does this work on XP using a CMD.EXE window:

	C:\Program Files>echo > "a b"
	
	C:\Program Files>copy "a b" "c d"
	        1 file(s) copied.
	
	C:\Program Files>copy "c:/program files/c d" "e f"
	        1 file(s) copied.
	
	C:\Program Files>copy "c:/program files/e f" "c:/program files/g h"
	        1 file(s) copied.

	C:\Program Files>cmd /c copy "c:/program files/e f" "c:/program files/g h"
	        1 file(s) copied.

I don't think we actually need the backslash conversion.  I do think we will end
up with a different GUC value for WIN32 PITR logging.

---------------------------------------------------------------------------

markir(at)coretech(dot)co(dot)nz wrote:
> Funny thing is, now that the "%p" is silently using '\', the "target" path can
> use '/':
> 
> e.g :
> 
> archive_command = 'copy "%p" "c:/databases/pgarchive/%f"'
> 
> *now* works fine. The next interesting question will be "can I use '/' in the
> restore_command too?". I will have a muddle around with it.
> 
> regards
> 
> Mark
> 
> Quoting markir(at)coretech(dot)co(dot)nz:
> 
> > I agree, the approach seems quite nice.
> >
> > I gave the lastest cvs a go  - which is probably cvs as of about 2 hours ago,
> > as
> > a mingw build takes 55 minutes on this machine (compare to 6 minutes when
> > booted into Freebsd... ah well..)
> >
> >
> > Initially tried :
> >
> > archive_command = 'copy "%p" "c:\databases\pgarchive\%f"'
> >
> > But saw errors in the log about "c:databasespgarchive00000..."
> >
> > Looks like '\' needs to be escaped, confirmed this with :
> >
> >
> > archive_command = 'copy "%p" "c:\\databases\\pgarchive\\%f"'
> >
> > Which worked fine. However, it would be nice if the '\' inside the '"' were
> > 'auto-escaped' somehow, as I suspect Mr 'used-windows-all-my-life' will find
> > the current behaviour counter-intuitive.
> >
> > Otherwise looks good
> >
> > Mark
> >
> >
> >
> > Quoting Andrew Dunstan <andrew(at)dunslane(dot)net>:
> >
> > > Tom Lane said:
> > > > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > >> I have gotten confused by this.  Does COPY work with quoted paths only
> > > >> if we use forward slashes, or was this fix just for the slash issue
> > > >> and not spaces?
> > > >
> > > > This only fixes the slash issue.  If your database path includes spaces
> > > > you'll still need to put quotes in the archive_command, but it
> > > > shouldn't be any worse than
> > > > 	archive_command = 'copy "%p" "c:\someplace\%f"'
> > > >
> > > > I'd appreciate confirmation though from some win32 users that the above
> > > > indeed works.
> > > >
> > >
> > > That's what my experimentation showed, although I worked with a tiny test.c
> > > file rather than the archive command. I think this is the right solution -
> > > the user should put the quotes in, not postgres.
> > >
> > > cheers
> > >
> > > andrew
> > >
> > >
> > >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
> > >
> >
> >
> >
> >
> 
> 
> 
> 

-- 
  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: Bruce MomjianDate: 2004-08-11 02:19:48
Subject: Re: PITR on Win32 - Archive and Restore
Previous:From: markirDate: 2004-08-11 01:57:29
Subject: Re: PITR on Win32 - Archive and Restore

pgsql-hackers-win32 by date

Next:From: Bruce MomjianDate: 2004-08-11 02:19:48
Subject: Re: PITR on Win32 - Archive and Restore
Previous:From: markirDate: 2004-08-11 01:57:29
Subject: Re: PITR on Win32 - Archive and Restore

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