Re: [review] 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: MauMau <maumau307(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "Magnus Hagander" <magnus(at)hagander(dot)net>
Subject: Re: [review] PostgreSQL Service on Windows does not start if data directory given is relative path
Date: 2014-02-20 08:44:48
Message-ID: BF2827DCCE55594C8D7A8F7FFD3AB7713DDC3434@SZXEML508-MBX.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 18 February 2014 21:47, MauMau Wrote:

> > We already have two different versions of make_absolute_path() in the
> > tree
> > - one in src/backend/utils/init/miscinit.c and one in
> > src/test/regress/pg_regress.c.
> >
> > I don't think we need a third one.
> >
> > If we put it in port/ like this patch done, then we should make the
> > other callers use it. We might need one for frontend and one for
> > backend (I haven't looked into that much detail), but definitely the
> > one between pg_regress and pg_ctl should be shared.
>
> Agreed. Sorry, I should have proposed the refactoring.
>
> Rajeev, could you refactor the code so that there is only one
> make_absolute_path()? I think we can do like this:
>
> 1. Delete get_absolute_path() in src/port/path.c.
> 2. Delete make_absolute_path() in src/test/regress/pg_regress.c.
> 3. Move make_absolute_path() from src/backend/utils/init/miscinit.c to
> src/port/path.c, and delete the declaration in miscadmin.h.
> 4. Modify make_absolute_path() in path.c so that it can be used both in
> backend and frontend. That is, surround the error message output with
> #ifdef FRONTEND ... #else ... #endif. See some other source files in
> src/port.

Changed the patch as per your suggestion.
Now only one version of make_absolute_path there defined in src/port/path.c

Found one small memory leak in the existing function make_absolute_path(miscinit.c),
fixed the same.

Please find the revised patch.

Thanks and Regards,
Kumar Rajeev Rastogi

Attachment Content-Type Size
pgctl_win32service_rel_dbpath_v5.patch application/octet-stream 6.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message amul sul 2014-02-20 08:49:13 Re: Selecting large tables gets killed
Previous Message Hiroshi Inoue 2014-02-20 08:43:59 Re: narwhal and PGDLLIMPORT