pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Add a "void *" passthrough pointer for psqlscan.l's callback fun
Date: Mon, 13 Mar 2017 21:14:51 +0000
Message-ID: <E1cnXIp-0002Az-VD@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/895e36bb3f36fdb7ec8e573be1a20d104fac820b

Modified Files
--------------
src/bin/psql/common.c               |  6 +++++-
src/bin/psql/common.h               |  3 ++-
src/bin/psql/psqlscanslash.l        |  3 ++-
src/fe_utils/psqlscan.l             | 19 +++++++++++++++++--
src/include/fe_utils/psqlscan.h     |  5 ++++-
src/include/fe_utils/psqlscan_int.h |  4 +++-
6 files changed, 33 insertions(+), 7 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1cnXIp-0002Az-VD@gemulon.postgresql.org>
Permalink:  ../E1cnXIp-0002Az-VD@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cnXIp-0002Az-VD@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Add a "void *" passthrough pointer for psqlscan.l's callback fun
  In-Reply-To: <E1cnXIp-0002Az-VD@gemulon.postgresql.org>
  References: <E1cnXIp-0002Az-VD@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox