Re: BUG #13853: initdb to UNC path

From: Nuri Boardman <NBoardman(at)idtus(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, John R Pierce <pierce(at)hogranch(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13853: initdb to UNC path
Date: 2016-01-07 22:45:09
Message-ID: 97E0A24F0C2ECC4EACB65491D0CCDDB30D5EDC6F6F@MX1.corp.idtus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

This command

pg_ctl.exe initdb -D localhost\Users\nboardman\test
just creates the whole DB locally starting at the current directory, and then going .\localhost\Users\... etc

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Thursday, January 07, 2016 2:21 PM
To: John R Pierce
Cc: Nuri Boardman; pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] BUG #13853: initdb to UNC path

John R Pierce <pierce(at)hogranch(dot)com> writes:
> On 1/7/2016 8:14 AM, NBoardman(at)idtus(dot)com wrote:
>> fixing permissions on existing directory
>> //localhost/Users/nboardman/test ... ok
>>
>> creating subdirectories ... initdb: could not create directory
>> "//localhost/Users": File exists

Hm. AFAICS, this failure must have occurred inside pg_mkdir_p, and what it implies is that stat(2) either failed entirely for "//localhost/Users", or claimed it isn't a directory. Either one seems more like a system problem than our problem.

> does it work if you leave out the \\localhost part? using network
> paths for database storage is NOT recommended.

This is true, and it's not an unreasonable bet that stat() is misbehaving because it's a network path.

Having said that, I wonder why initdb is coded to use pg_mkdir_p rather than plain mkdir for creating subdirectories after the datadir has been created. There is basically no advantage there, and there's certainly scope for things to go wrong, as this example shows.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Greg Stark 2016-01-07 23:50:55 Re: BUG #13849: Need a parameter added similar to "edb_stmt_level_tx"
Previous Message Pavel Stehule 2016-01-07 21:35:48 Re: BUG #13850: Need a parameter added similar to "edb_stmt_level_tx"