Обсуждение: Re: PITR on Win32 - Archive and Restore

Поиск
Список
Период
Сортировка

Re: PITR on Win32 - Archive and Restore

От
Tom Lane
Дата:
Bruce Momjian <pgman@candle.pha.pa.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.

            regards, tom lane

Re: PITR on Win32 - Archive and Restore

От
Tom Lane
Дата:
"Andrew Dunstan" <andrew@dunslane.net> writes:
> I think this is the right solution -
> the user should put the quotes in, not postgres.

Yeah, I'd prefer it that way if at all possible.  I think that having %p
generate the quotes would be making too many assumptions about what the
command string is going to do with the path.

            regards, tom lane

Re: PITR on Win32 - Archive and Restore

От
"Andrew Dunstan"
Дата:
Tom Lane said:
> Bruce Momjian <pgman@candle.pha.pa.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




Re: PITR on Win32 - Archive and Restore

От
markir@coretech.co.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@dunslane.net>:

> Tom Lane said:
> > Bruce Momjian <pgman@candle.pha.pa.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@postgresql.org
>





Re: PITR on Win32 - Archive and Restore

От
markir@coretech.co.nz
Дата:
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@coretech.co.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@dunslane.net>:
>
> > Tom Lane said:
> > > Bruce Momjian <pgman@candle.pha.pa.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@postgresql.org
> >
>
>
>
>