Andres Freund <andres@anarazel.de> writes:
> On 2022-11-23 18:11:22 -0500, Tom Lane wrote:
>> Huh ... do you recall the details? Large as tab-complete is, it's
>> far smaller than gram.y:
> So It might just be that we need to split up that very long "else if" chain in
> psql_completion().
Could be, yeah. Related point: I've wondered for awhile how long that
chain can get before we start noticing performance issues on slower
machines. Even when the standard is just human reaction time, there's
a limit to how many cycles you can throw away. So I'd like to see it
refactored somehow to be a bit less stupid --- but I have a nagging
feeling that we'd end up building some special-purpose program generator,
which is something I've not wanted to do. OTOH, in the best of all
possible worlds such a tool might make it easier to add tab
completions?
(In the past I've fantasized about auto-generating tab completion
logic from the backend grammar, but I fear it's just fantasy.
The backend grammar isn't factored right, and too many of its names
don't have clear traceability to what-kind-of-object-is-that.)
regards, tom lane