BUG #16217: ECPG call interface && filename of the foo.pgc file for logging

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: guru(at)unixarea(dot)de
Subject: BUG #16217: ECPG call interface && filename of the foo.pgc file for logging
Date: 2020-01-17 15:03:03
Message-ID: 16217-ea3185dd00d0367e@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16217
Logged by: Matthias Apitz
Email address: guru(at)unixarea(dot)de
PostgreSQL version: 11.4
Operating system: SuSE Linux SLES 12 SP4
Description:

Actually, the ecpg pre-compiler resolves ESQL/C statements like

EXEC SQL SELECT ....

into a function call to the executer in the ecpglib as:

ECPGdo(__LINE__, ...);

where __LINE__ is later substituted by the C-precompiler by the current
line number as an integer. The purpose is mostly for logging features
like:

[24304] [14.01.2020 12:05:18:433]: ECPGtrans on line 1108: action
"rollback"; connection "sisis71"

i.e. to have the line number in the log statement
(btw: the date and timestamp is already a local modification we did to
bring the log line in sync with other logs our application is writing).

In a real world server application written in some hundreds foo.pgc
files (a generated application interface with the pgc files based on
the 400 tables in the database), it would be nice to have the call done
like this:

ECPGdo(__LINE__, __FILE__, ...)

and the resulting log line like this:

[24304] [14.01.2020 12:05:18:433]: ECPGtrans on line 1108 in file D01buch.c:
action "rollback"; connection "sisis71"

As this is an additional parameter to ECPGdo() function and would invalidate
existing/compiled applications it should be somehow implemented optional,
adding a new option to the precompiler command ecpg, generating calls to a
changed function as ECPGdoNew(....) which stores the __FILE__ arg in some
static variable, calling the old function ECPGdo() without the __FILE__ arg
and the logging routines below use the static variable if set. Or something
like this.

Before hacking this into the ecpglib code by my own, I wanted to file this
here as an oficial Change Request.

Thanks

matthias
--
Matthias Apitz, ✉ guru(at)unixarea(dot)de, http://www.unixarea.de/
+49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub

Browse pgsql-bugs by date

  From Date Subject
Next Message Fabien COELHO 2020-01-17 15:15:15 Re: BUG #16216: the result of to_date function with negative year number not same as BC year number
Previous Message Tom Lane 2020-01-17 14:59:42 Re: BUG #16216: the result of to_date function with negative year number not same as BC year number