Skip to content

sql/parser: parse CREATE PROCEDURE#106325

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
mgartner:parse-procs
Jul 26, 2023
Merged

sql/parser: parse CREATE PROCEDURE#106325
craig[bot] merged 3 commits intocockroachdb:masterfrom
mgartner:parse-procs

Conversation

@mgartner
Copy link
Copy Markdown
Contributor

@mgartner mgartner commented Jul 6, 2023

sql/parser: parse CREATE PROCEDURE

CREATE PROCEDURE statements can now be parsed by the SQL parser.
Currently, executing CREATE PROCEDURE will produce an unimplemented
error.

Epic: CRDB-25388

Release note: None

sem/tree: rename function AST nodes

This commit renames UDF-related AST nodes with "function" in the name to
use the more general term "routine". The term "routine" is inclusive of
both UDFs and procedures (e.g., Postgres implements a DROP ROUTINE
statement which drops both UDFs and procedures), which is fitting
because we'll be using the same AST nodes for both CREATE FUNCTION and
CREATE PROCEDURE statements.

Release note: None

sem/tree: rename udf.go to create_routine.go

Release note: None

@mgartner mgartner requested review from a team as code owners July 6, 2023 18:42
@mgartner mgartner requested review from a team and samiskin and removed request for a team July 6, 2023 18:42
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@mgartner mgartner requested review from a team and removed request for a team July 6, 2023 18:44
@mgartner mgartner force-pushed the parse-procs branch 3 times, most recently from 99c49c9 to 059e2ea Compare July 10, 2023 15:22
Copy link
Copy Markdown
Collaborator

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

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

:lgtm: Definitely more renaming to do, but we can do more passes later.

Reviewed 16 of 16 files at r1, 49 of 49 files at r2, 3 of 3 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @chengxiong-ruan, @mgartner, and @samiskin)


pkg/sql/parser/help_test.go line 576 at r1 (raw file):

		{`ALTER FUNCTION ??`, `ALTER FUNCTION`},
		{`DROP FUNCTION ??`, `DROP FUNCTION`},

[nit] Is this line meant to be here?

Copy link
Copy Markdown
Contributor Author

@mgartner mgartner left a comment

Choose a reason for hiding this comment

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

Any specific renaming you had in mind?

I originally renamed everything, then reverted a few things like options that only apply to UDFs and not procedures. We could rename them anyway - whatever is less confusing.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @chengxiong-ruan, @DrewKimball, and @samiskin)


pkg/sql/parser/help_test.go line 576 at r1 (raw file):

Previously, DrewKimball (Drew Kimball) wrote…

[nit] Is this line meant to be here?

I added the new line to separate it from the UDF statements, to follow the pattern above.

@DrewKimball
Copy link
Copy Markdown
Collaborator

Any specific renaming you had in mind?

Just small things like createFunctionNode, setFuncOptions, that sort of thing.

I originally renamed everything, then reverted a few things like options that only apply to UDFs and not procedures.

This sounds reasonable to me.

@chengxiong-ruan
Copy link
Copy Markdown
Contributor

I'll give this a look today as well.

@chengxiong-ruan chengxiong-ruan requested a review from Xiang-Gu July 17, 2023 17:59
Copy link
Copy Markdown
Contributor

@chengxiong-ruan chengxiong-ruan left a comment

Choose a reason for hiding this comment

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

LGTM. Nice work

@mgartner mgartner force-pushed the parse-procs branch 4 times, most recently from 9a1f270 to 5843cfc Compare July 24, 2023 21:28
@mgartner mgartner requested a review from a team as a code owner July 24, 2023 21:28
@mgartner
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 25, 2023

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 25, 2023

Build failed (retrying...):

@mgartner
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 25, 2023

Already running a review

@mgartner
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 25, 2023

Already running a review

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 25, 2023

Build failed (retrying...):

@yuzefovich
Copy link
Copy Markdown
Member

I think this might need a rebase.

[20:44:43][CheckGeneratedCode] pkg/sql/sem/builtins/pg_builtins.go:742:28: undefined: tree.FunctionLangSQL
[20:44:43][CheckGeneratedCode] pkg/sql/sem/builtins/pg_builtins.go:2206:28: undefined: tree.FunctionLangSQL

bors r-

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 25, 2023

Canceled.

mgartner added 3 commits July 25, 2023 15:45
`CREATE PROCEDURE` statements can now be parsed by the SQL parser.
Currently, executing `CREATE PROCEDURE` will produce an unimplemented
error.

Epic: CRDB-25388

Release note: None
This commit renames UDF-related AST nodes with "function" in the name to
use the more general term "routine". The term "routine" is inclusive of
both UDFs and procedures (e.g., Postgres implements a `DROP ROUTINE`
statement which drops both UDFs and procedures), which is fitting
because we'll be using the same AST nodes for both `CREATE FUNCTION` and
`CREATE PROCEDURE` statements.

Release note: None
@mgartner
Copy link
Copy Markdown
Contributor Author

bors r+

@craig craig bot merged commit 68985a2 into cockroachdb:master Jul 26, 2023
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 26, 2023

Build succeeded:

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.

5 participants