SQL comments to index positional arguments #3976
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a small non-functional change to serve as a sort of async discussion thread.
@mathemancer and @Anish9901, what would your appetite be for allowing some manually-maintained comments in our SQL codebase like this? I recognize that they're more work to maintain. But, being that code gets read more than written, I would find comments like this quite helpful. Personally, I don't think I've ever worked with such poorly readable code in my whole career. Like, I cannot believe I need to manually count over a dozen expressions just to read something. This is not to blame anyone who wrote this particular code, but rather just a general frustration with the limited expressiveness of PL/pgSQL.
With the comments there, I can highlight a positional index and then see all the places it occurs like this:
But if you don't like the idea of these comment indexes, then I won't make a stink about it, and we can close this PR. Or, if you like this idea, then we can merge this and add them as needed.
I'm not proposing that we use them everywhere. And I'm not proposing that we do any additional work to go add them all over the place right now. I'd just like to be able to add them to code blocks like this which are particularly unwieldy.
I have a VS Code extension called vscode-input-sequence which makes adding and updating sequences like this pretty easy. Perhaps theres Emacs as something like this too.
Checklist
Update index.md
).develop
branch of the repositoryDeveloper Certificate of Origin
Developer Certificate of Origin