Re: BUG #16502: EXPLAIN JSON format adds extra quotes around index names
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Euler Taveira <euler.taveira@2ndquadrant.com>
Cc: pgsql-bugs@lists.postgresql.org, m.sakrejda@gmail.com
Date: 2020-06-20T22:11:09Z
Lists: pgsql-bugs
Attachments
- fix-EXPLAINs-index-name-quoting.patch (text/x-diff) patch
I wrote: > Agreed as to the bug, but I think we ought to fix it by redefining > explain_get_index_name's API as "return the bare index name always", > and let the callers apply quoting. Concretely, as attached. I am unsure about back-patching this, but am leaning to doing so. (1) From the perspective of end users, this makes no difference for text output and fixes a pretty clear bug in non-text formats. If we don't fix it then users may be tempted to try to dequote in application code, which won't work very reliably and will do completely the wrong thing after the bug is fixed. You might argue that some apps might already be applying such dequoting, but I doubt it; wouldn't they have reported the bug? (2) From the perspective of extensions using explain_get_index_name_hook, this is a silent API change: before they were supposed to quote, now they are not. That's not great, but I don't think there is any fix that doesn't involve an API change for hook users. There's certainly a case to be made that it'd be better if the API change happened only in v13 and not in minor releases. But the consequences of not updating a hook-using extension immediately wouldn't be that severe --- non-text output is just as it was, and the double-double-quoting in text output would only be visible if the extension chooses quote-requiring names for hypothetical indexes. Even if it were visible it probably would just be ugly, and not fundamentally break anything. In any case, I think there are few enough people using index-advisor extensions that we should not let consideration (2) outweigh consideration (1). regards, tom lane
Commits
-
Undo double-quoting of index names in non-text EXPLAIN output formats.
- dda25c599fcf 9.5.23 landed
- d3d8755180b6 12.4 landed
- bd53ea2b270f 9.6.19 landed
- 6d9f7a094ca7 10.14 landed
- 63d2ac23b018 14.0 landed
- 57f8b9913b91 13.0 landed
- 35a8e227e6c6 11.9 landed