Re: PITR on Win32 - Archive and Restore

[email protected]
Newsgroups gmane.comp.db.postgresql.devel.win32
Message-ID <[email protected]>
That problem is because there is no copy.exe, it's part of cmd. I am afraid I
introduced that confusion while trying out all sorts of things in
archive_command....

I suspect that your example may be working because of your current directory is
where your test files happen to be (the business of quoted forward slash paths
working *if* they point to your current working directory is very odd).

Consistency is generally lacking commands as well - e.g:

C:\Databases>cd "c:/program files"
The system cannot find the path specified.

C:\Databases>dir "c:/program files"
 Volume in drive C has no label.
 Volume Serial Number is F444-3F9F

 Directory of c:\program files

11/08/2004  15:02       <DIR>          .
11/08/2004  15:02       <DIR>          ..
24/08/2003  03:13       <DIR>          Accessories
23/08/2003  18:20       <DIR>          ATI Technologies
08/09/2003  17:22       <DIR>          CheckPoint
07/08/2004  14:18       <DIR>          Common Files


Mark
Quoting Bruce Momjian <[email protected]>:

>
> OK, I have a solution.  It turns out that COPY and COPY.EXE behave
> differently.  :-O
>
> 	# cat x.c
> 	#include <stdio.h>
>
> 	main()
> 	{
> 	        system("copy.exe \"c:/msys/1.0/home/bruce momjian/a b\"
> 	\"c:/msys/1.0/home/bruce momjian/c d\"");
> 	}
> 	# gcc -o x x.c
> 	# ./x
> 	The system cannot find the file specified.
>
> I just changed copy to copy.exe, and bingo, failure.
>
> I suggest we back out the backslash patch and provide a Win32 sample
> archive line in postgresql.conf that quotes both args, and that we add
> quotes to the Unix example too.
>
> ---------------------------------------------------------------------------
>
> [email protected] 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 [email protected]:
> >
> > > 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 <[email protected]>:
> > >
> > > > Tom Lane said:
> > > > > Bruce Momjian <[email protected]> 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
> [email protected]
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   [email protected]               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
>





---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [email protected] so that your
      message can get through to the mailing list cleanly
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.