Re: Rationalizing code-sharing among src/bin/ directories

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Rationalizing code-sharing among src/bin/ directories
Date: 2016-03-25 04:43:53
Message-ID: CAB7nPqT6zMvnVogfBRBtGvM66MEt0iaDvkVbHvv=+c2pqjwO=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 25, 2016 at 12:55 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
>> Not sure if Andres is working on that for now or not, the main
>> discussion that I am foreseeing here is how we are going to map elevel
>> for the frontend (should FATAL, PANIC exit immediately, etc).
>
> Doesn't seem that complicated to me: elevel >= ERROR results in exit(1),
> otherwise just print to stderr and return. We'd be eyeballing each case
> that we remove "#ifndef FRONTEND" from anyway; if it's expecting behavior
> noticeably more complicated than that, we could leave it as-is.

Something that I see as mandatory as well is a way to bypass some of
the elevels depending on the way a frontend tool is called, so we'd
need something like that in the common elog facility:

void
elog(blah)
{
#ifdef FRONTEND
if (!callback_routine_defined_in_frontend(elevel))
return;
#endif

blah_blah_move_on.
}

This would be useful to avoid code patterns of this type in a frontend
tool where for example a debug flag is linked with elevel. For example
this pattern:
if (debug)
elog(DEBUG1, "Debug blah");
could be reduced to as the callback routine would allow bypassing
elog() directly:
elog(DEBUG1, "Debug blah");

That's just food for thought at this stage, I get back to reviewing...
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-03-25 06:10:22 Re: Optimization for updating foreign tables in Postgres FDW
Previous Message Ashutosh Bapat 2016-03-25 04:37:39 Re: Odd system-column handling in postgres_fdw join pushdown patch