On Thu, Oct 1, 2020 at 11:19 AM Tom Lane <t...@sss.pgh.pa.us> wrote:
> 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.

A ringing endorsement if I ever heard one. ;-) Seems fine if it
remains in guc-file.l. Cosmetic considerations are

- The declaration in guc.h should fit in with code that's already
there. I put it next to the *Parse* functions.
- There seem to be a few unused headers included into bootscanner.l.
To keep "#include guc.h" from looking as strange as those, I added a
comment. It might be worth removing those extra includes, but that's
for another day.

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

I've named it DeescapeQuotedString to see how that looks.

> 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().

v2 done that way.

-- 
John Naylor                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment: v2-0001-Remove-duplicate-scanstr-function.patch
Description: Binary data

Reply via email to