On Fri, Oct 24, 2014 at 1:42 AM, Craig Ringer <cr...@2ndquadrant.com> wrote: > On 10/23/2014 09:21 PM, Robert Haas wrote: >> Agreed - I think if you want an error check here it should use elog() >> or ereport(), not Assert(). > > That's what I originally did, but it's too early for elog. > > I'm reluctant to just fprintf(...) to stderr, as there's no way for the > user to suppress that, and it'll be emitted for each backend start. > Though on the other hand it really is a "shouldn't happen" case. > > So the options seem to be ignoring the error silently or printing to stderr.
Either of those is OK with me. I think it's a bad idea to use Assert() to check the results of system calls, because an assertion failure is supposed to indicate a bug in our code, not Microsoft's code. But printing to stderr is an acceptable way of indicating an error that happens very early, and ignoring doesn't look unreasonable in this context either. Yet another option is to do nothing about the error at the time that it's reported but store the error code somewhere and use it to generate an error message once the system is initialized. I'm tentatively inclined to believe that's more machinery than this particular case justifies, but will happily defer to any emerging consensus. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers