Add a "void *" passthrough pointer for psqlscan.l's callback functions.
Tom Lane <tgl@sss.pgh.pa.us>
Add a "void *" passthrough pointer for psqlscan.l's callback functions. The immediate motivation for this is to provide clean infrastructure for the proposed \if...\endif patch for psql; but it seems like a good thing to have even if that patch doesn't get in. Previously the callback functions could only make use of application-global state, which is a pretty severe handicap. For the moment, the pointer is only passed through to the get_variable callback function. I considered also passing it to the write_error callback, but for now let's not. Neither psql nor pgbench has a use for that, and in the case of psql we'd have to invent a separate wrapper function because we would certainly not want to change the signature of psql_error(). Discussion: https://postgr.es/m/10108.1489418309@sss.pgh.pa.us
Files
| Path | Change | +/− |
|---|---|---|
| src/bin/psql/common.c | modified | +5 −1 |
| src/bin/psql/common.h | modified | +2 −1 |
| src/bin/psql/psqlscanslash.l | modified | +2 −1 |
| src/fe_utils/psqlscan.l | modified | +17 −2 |
| src/include/fe_utils/psqlscan.h | modified | +4 −1 |
| src/include/fe_utils/psqlscan_int.h | modified | +3 −1 |
Discussion
- \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless) 230 messages · 2017-01-22 → 2017-04-14