Re: small cleanup: unify scanstr() functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Naylor <john(dot)naylor(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: small cleanup: unify scanstr() functions
Date: 2020-10-01 15:19:12
Message-ID: 1044817.1601565552@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

John Naylor <john(dot)naylor(at)2ndquadrant(dot)com> writes:
> In the attached, the GUC_scanstr() function body is moved to scansup.c
> to replace scanstr(), but with a different order of if-statements to
> make the diff smaller. Since we have control over what goes in the BKI
> file, we can use single-quoted escape strings there, allowing removal
> of special case code for double quotes.

I'm unsure this topic is worth messing with. But if we do so, I'd kind
of like to move scanstr() out of parser/scansup.c. Since it's not used
by the core scanner, only bootstrap, it seems out of place there; and
it's confusing because somebody coming across it for the first time
would reasonably assume that it does have something to do with how
we lex normal SQL strings.

Of course, that just begs the question of where to put it instead.
But since guc-file.l lives in utils/misc/, in or beside that file
does not seem that awful.

We might consider renaming it to something a shade less generic, too.
I have no immediate suggestions on that score.

In short: maybe instead of what you have here, leave GUC_scanstr()
alone except for a possible rename; make bootscanner.l use that;
and drop the now-unused scanstr().

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2020-10-01 15:38:40 Should walsernder check correctness of WAL records?
Previous Message Fujii Masao 2020-10-01 14:39:57 Re: Retry Cached Remote Connections for postgres_fdw in case remote backend gets killed/goes away