Re: pgsql-server/src backend/main/main.c backend/p ...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql-server/src backend/main/main.c backend/p ...
Date: 2004-05-19 16:31:07
Message-ID: 17867.1084984267@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Tom Lane wrote:
>> momjian(at)svr1(dot)postgresql(dot)org (Bruce Momjian) writes:
>>> Remove elog() calls from find_my_exec; do fprintf(stderr) instead.
>>
>> Isn't that a seriously bad idea?

> Yes, it probably is bad, but I am not sure how frequently this will
> happen, _and_ I need to set my_exec_path very far up in the tree to the
> timezone stuff knows the location, hence the fact that elog() calls
> wouldn't work at all anyway, I think.

The more I think about this, the less I like it.

find_my_exec and friends are *not* more critical to the backend than
elog is, and should not be done sooner. The argument that "we have to
find postgresql.conf before elog works" is specious --- elog will work
fine before we have read the config file, indeed had better do so since
guc.c uses elog to report problems. What will happen is that errors
will get reported to the compiled-in-default location, which happens to
be stderr at the moment. All you are accomplishing with this change is
to hard-wire that default and make it impossible to change in the
future.

Other concerns: I do not like changing random error reports from elog to
printf, firstly because it will encourage people to code other error
reports as printfs, which is something that took us a huge amount of
work to stamp out, and secondly because the requirement will propagate.
Are you going to avoid using palloc in find_my_exec, too? What about in
any subroutines that these things call?

I recommend reverting both this change and the ones to do find_my_exec
etc in main.c. You're better off doing these things where they were
done in PostmasterMain, PostgresMain, etc. palloc and elog are simply
fundamental parts of the backend programming environment; it does not
make sense to push complex functionality into a part of the code where
they aren't available.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2004-05-19 17:14:58 Re: [COMMITTERS] pgsql-server/src backend/main/main.c backend/p ...
Previous Message Magnus Hagander 2004-05-19 15:16:53 Re: pgsql-server/src backend/main/main.c backend/p ...

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-05-19 16:39:38 Re: new aggregate functions v1
Previous Message Fabien COELHO 2004-05-19 09:44:02 new aggregate functions v4