Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-29 Thread Andrew Dunstan
Tom Lane wrote: Andrew Dunstan <[EMAIL PROTECTED]> writes: How about (even quicker and dirtier) putting a limited loop (say 5 iterations?) with a small delay in it around the check for whether or not we are the only connection? Createdb is hardly a time critical operation, and taking a few s

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-29 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > How about (even quicker and dirtier) putting a limited loop (say 5 > iterations?) with a small delay in it around the check for whether or > not we are the only connection? Createdb is hardly a time critical > operation, and taking a few seconds extra

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-29 Thread Andrew Dunstan
Tom Lane wrote: Andrew Dunstan <[EMAIL PROTECTED]> writes: Longer term, a robust mechanism for DB level locks would probably be preferable, I guess, so I'm not sure if my idea is worth doing in the mean time. Presumably it hasn't caused much of a problem up to now, since most people are not

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-28 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > Longer term, a robust mechanism for DB level locks would probably be > preferable, I guess, so I'm not sure if my idea is worth doing in the > mean time. Presumably it hasn't caused much of a problem up to now, > since most people are not likely to mo

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-28 Thread Andrew Dunstan
Tom Lane wrote: A final point is that implementing CREATE DATABASE via "cp -r" is and always has been fundamentally broken anyway, because of the lack of interlocking against other backends changing the source database. We have a very half-baked defense against that (erroring out if anyone else

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-15 Thread Bruce Momjian
I added this comment to the code in case we don't fix cp -r: /* We might need to use cp -R one day for portability */ --- Tom Lane wrote: > Andrew Dunstan <[EMAIL PROTECTED]> writes: > > IIRC we don't copy anything but

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-12 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > IIRC we don't copy anything but plain files and directories - no special > files, symlinks or fifos, so the -R/-r differences shouldn't affect us > anyway, should they? Also, that should make the implementation of an > internal recursive copy much sim

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-12 Thread Andrew Dunstan
Tom Lane wrote: Bruce Momjian <[EMAIL PROTECTED]> writes: but my BSD/OS manual only documents 'cp -R' and mentions: I think we should switch to -R in our code. And break the code on who knows how many other systems? No thanks. If we want to do anything at all with this code, we should el

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-12 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > but my BSD/OS manual only documents 'cp -R' and mentions: > I think we should switch to -R in our code. And break the code on who knows how many other systems? No thanks. If we want to do anything at all with this code, we should eliminate the use of s

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-11 Thread Bruce Momjian
Andrew Dunstan wrote: > Nigel J. Andrews said: > > On Thu, 11 Dec 2003, Alvaro Herrera wrote: > > > >> On Thu, Dec 11, 2003 at 06:36:05PM -0500, Bruce Momjian wrote: > >> > Our dbcommands.c has for create database: > >> > > >> > snprintf(buf, sizeof(buf), "cp -r '%s' '%s'", src_loc, > >> >

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-11 Thread Andrew Dunstan
Nigel J. Andrews said: > On Thu, 11 Dec 2003, Alvaro Herrera wrote: > >> On Thu, Dec 11, 2003 at 06:36:05PM -0500, Bruce Momjian wrote: >> > Our dbcommands.c has for create database: >> > >> > snprintf(buf, sizeof(buf), "cp -r '%s' '%s'", src_loc, >> > target_dir); >> > >> [...] >> > >> > I

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-11 Thread Bruce Momjian
Nigel J. Andrews wrote: > On Thu, 11 Dec 2003, Alvaro Herrera wrote: > > > On Thu, Dec 11, 2003 at 06:36:05PM -0500, Bruce Momjian wrote: > > > Our dbcommands.c has for create database: > > > > > > snprintf(buf, sizeof(buf), "cp -r '%s' '%s'", src_loc, target_dir); > > > > > [...] > > > > >

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-11 Thread Nigel J. Andrews
On Thu, 11 Dec 2003, Alvaro Herrera wrote: > On Thu, Dec 11, 2003 at 06:36:05PM -0500, Bruce Momjian wrote: > > Our dbcommands.c has for create database: > > > > snprintf(buf, sizeof(buf), "cp -r '%s' '%s'", src_loc, target_dir); > > > [...] > > > > I think we should switch to -R in our cod

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-11 Thread Philip Yarra
On Fri, 12 Dec 2003 10:36 am, Bruce Momjian wrote: > I think we should switch to -R in our code. Both -r and -R are supported on Linux (fileutils 4.1), Tru64 v4.0 and Solaris (at least as far back as 2.6) so no complaints here. Regards, Philip. ---(end of broadcast)

Re: [HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-11 Thread Alvaro Herrera
On Thu, Dec 11, 2003 at 06:36:05PM -0500, Bruce Momjian wrote: > Our dbcommands.c has for create database: > > snprintf(buf, sizeof(buf), "cp -r '%s' '%s'", src_loc, target_dir); > [...] > > I think we should switch to -R in our code. But you will have to write special code for Win32, won't

[HACKERS] Use of 'cp -r' in CREATE DATABASE

2003-12-11 Thread Bruce Momjian
Our dbcommands.c has for create database: snprintf(buf, sizeof(buf), "cp -r '%s' '%s'", src_loc, target_dir); but my BSD/OS manual only documents 'cp -R' and mentions: Historic versions of the cp utility had a -r option. This implementation supports that option, however, its use i