PostgreSQL Service on Windows does not start if data directory given is relative path

From: Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: PostgreSQL Service on Windows does not start if data directory given is relative path
Date: 2014-01-06 11:42:08
Message-ID: BF2827DCCE55594C8D7A8F7FFD3AB7713DDB5BEC@SZXEML508-MBX.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have found a case that PostgreSQL as win32 service does not start, if the data directory given as relative path.
Error observed in this case is:
"The PostgreSQL on Local Computer started and then stopped".

This may happen because relative path given will be relative to path from where service is registered but
the path from where WIN32 service execution gets invoked may be different and hence it won't be able
to find the data directory.

I have fixed the same by internally converting the relative path to absolute path as it is being done for executable file.

Attached is the patch with the fix.
Please provide your opinion.

I will add this to Jan 2014 CommitFest.

Thanks and Regards,
Kumar Rajeev Rastogi

Attachment Content-Type Size
pgctl_win32service_rel_dbpath.patch application/octet-stream 2.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sandeep Thakkar 2014-01-06 11:44:33 Re: Compiling extensions on Windows
Previous Message Andres Freund 2014-01-06 11:30:27 Re: dynamic shared memory and locks