From: | John Naylor <john(dot)naylor(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: small cleanup: unify scanstr() functions |
Date: | 2020-10-01 17:55:43 |
Message-ID: | CACPNZCsH30MhQGHO+NyfaAS1-_G9QN+zniHuQ1KT4h+uRo9K8A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Oct 1, 2020 at 11:19 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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 | Content-Type | Size |
---|---|---|
v2-0001-Remove-duplicate-scanstr-function.patch | application/octet-stream | 11.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2020-10-01 18:26:30 | Re: Improving connection scalability: GetSnapshotData() |
Previous Message | Andy Fan | 2020-10-01 16:04:34 | Improve choose_custom_plan for initial partition prune case |