On 30/12/2018 20:45, Tom Lane wrote: > It seems like a shame that src/common files still need to have > #ifdef FRONTEND variant code to deal with frontend vs. backend > conventions. I wonder how hard it would be to layer some subset of > ereport() functionality on top of what you have here, so as to get > rid of those #ifdef stanzas.
The patch does address that in some places: @@ -39,12 +45,7 @@ pgfnames(const char *path) dir = opendir(path); if (dir == NULL) { -#ifndef FRONTEND - elog(WARNING, "could not open directory \"%s\": %m", path); -#else - fprintf(stderr, _("could not open directory \"%s\": %s\n"), - path, strerror(errno)); -#endif + pg_log_warning("could not open directory \"%s\": %m", path); return NULL; } It's worth noting that less than 5 files are of concern for this, so creating a more elaborate system would probably be more code than you'd save at the other end. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services