From: Tom Lane [tgl@sss.pgh.pa.us]
Sent: Tuesday, August 21, 2012 10:31 PM
Amit Kapila <amit.kapila@huawei.com> writes:
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Tom Lane
>> * pg_ctl crashes on Win32 when neither PGDATA nor -D specified
>>> isn't there a way to actually test if we're in a restricted process?
>> Do you mean to say that it should check if pg_ctl runs as an administrative
>> user then do the re-fork in restricted mode.
> Something like that. The proposed patch depends on there not being a
> conflicting environment variable, which seems rather fragile to me.
> Can't we test the same condition that postgres.exe itself would test?
To implement the postgre.exe way we have following options:
1. Duplicate the function pgwin32_is_admin and related function to pg_ctl, as currently it is not exposed.
2. Make that visible to pg_ctl, but for that it need to link with postgre lib.
3. Move the functions to some common place may be src/port.
4. any other better way?
Curretly I have implemented the patch with Approach-1, but I believe Approach-3 would have been better.
However I was not sure which is the best place to move functions, so I have implemented with Approach-1.
Please let me know if the attached patch is acceptable. I shall wait today night for your confirmation and shall let
youknow before
I leave my work place in which case I shall complete tommorow morning but not sure whether that much delay is
acceptable.
With Regards,
Amit Kapila.