Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plpgsql: improve block formatting and unimplemented errors #117608

Merged
merged 2 commits into from Jan 12, 2024

Conversation

DrewKimball
Copy link
Collaborator

plpgsql: misc formatting fixes

This commit makes a few fixes to formatting for PL/pgSQL routines in
preparation for nested blocks support, as well as a few misc fixes:

  1. Blocks now print a semicolon after END. While the semicolon is
    optional for the root block, it is non-optional for nested blocks.
  2. Block labels are now correctly displayed (previously, they were ignored).
  3. An extra newline has been removed from the output of SHOW CREATE FUNCTION
    and SHOW CREATE PROCEDURE.
  4. RAISE statements now capitalize the log level (e.g. notice -> NOTICE).

Informs #114775
Informs #112136

Release note: None

plpgsql: return errors for block labels

This commit adds a parse-time check that the labels on a PLpgSQL block
(if any) match. If the labels do not match, an expected syntax error is
returned. This commit also adds an "unimplemented" error for block labels.
Finally, errors that don't use formatting arguments have been moved to the
bottom of the file for clarity.

Informs #114775

Release note (bug fix): Incorrectly labeled PL/pgSQL blocks now return
an expected syntax error.

@DrewKimball DrewKimball requested review from a team as code owners January 10, 2024 10:10
@DrewKimball DrewKimball requested review from msbutler and rharding6373 and removed request for a team January 10, 2024 10:10
Copy link

blathers-crl bot commented Jan 10, 2024

Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@DrewKimball DrewKimball requested review from mgartner and a team and removed request for a team and msbutler January 10, 2024 10:11
@DrewKimball
Copy link
Collaborator Author

The first commit is #117511.

Copy link
Collaborator

@rharding6373 rharding6373 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Great! Looks like there's a few more tests to clean up with the new formatting, but otherwise, LGTM!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @mgartner)

This commit makes a few fixes to formatting for PL/pgSQL routines in
preparation for nested blocks support, as well as a few misc fixes:
1. Blocks now print a semicolon after `END`. While the semicolon is
   optional for the root block, it is non-optional for nested blocks.
2. Block labels are now correctly displayed (previously, they were ignored).
3. An extra newline has been removed from the output of `SHOW CREATE FUNCTION`
   and `SHOW CREATE PROCEDURE`.
4. RAISE statements now capitalize the log level (e.g. `notice` -> `NOTICE`).

Informs cockroachdb#114775
Informs cockroachdb#112136

Release note: None
This commit adds a parse-time check that the labels on a PLpgSQL block
(if any) match. If the labels do not match, an expected syntax error is
returned. This commit also adds an "unimplemented" error for block labels.
Finally, errors that don't use formatting arguments have been moved to the
bottom of the file for clarity.

Informs cockroachdb#114775

Release note (bug fix): Incorrectly labeled PL/pgSQL blocks now return
an expected syntax error.
@DrewKimball
Copy link
Collaborator Author

TFTR!

@DrewKimball
Copy link
Collaborator Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 12, 2024

Build succeeded:

@craig craig bot merged commit c0d1437 into cockroachdb:master Jan 12, 2024
9 checks passed
@DrewKimball DrewKimball deleted the plpgsql-format branch January 12, 2024 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants