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

sql/opt: support anonymous subqueries in CREATE FUNCTION #97544

Merged
merged 1 commit into from
Feb 23, 2023

Conversation

knz
Copy link
Contributor

@knz knz commented Feb 23, 2023

Needed for #97515.
Fixes #96375.

Release note (bug fix): CockroachDB now supports using subqueries in UDFs without an AS clause, for consistency with the syntax supported outside of UDFs. (Subqueries without an AS clause is a CRDB-specific extension.)

@knz knz requested a review from a team as a code owner February 23, 2023 04:17
@cockroach-teamcity
Copy link
Member

This change is Reviewable

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.

Thanks for this! The f_subquery_unaliased and f_ambiguous tests in pkg/sql/logictest/testdata/logic_test/udf_star should no longer have an error, so you'll need to update the logic test:

CREATE FUNCTION f_subquery_unaliased() RETURNS INT AS

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @DrewKimball and @michae2)

@knz knz force-pushed the 20230222-anon-subquery branch from 9c49457 to a21fe3b Compare February 23, 2023 04:39
@knz
Copy link
Contributor Author

knz commented Feb 23, 2023

you'll need to update the logic test

Done.

(Turns out it wasn't the only one!)

@knz knz requested a review from rharding6373 February 23, 2023 04:39
@knz knz force-pushed the 20230222-anon-subquery branch from a21fe3b to 2d42c84 Compare February 23, 2023 04:40
Copy link
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: Nice fix!

Reviewed 4 of 4 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @michae2 and @rharding6373)

Release note (bug fix): CockroachDB now supports using subqueries in
UDFs without an AS clause, for consistency with the syntax supported
outside of UDFs. (Subqueries without an AS clause is a CRDB-specific
extension.)
@knz
Copy link
Contributor Author

knz commented Feb 23, 2023

The new tests revealed this separate issue #97546, which i will not let hold up this PR.

@knz knz force-pushed the 20230222-anon-subquery branch from 2d42c84 to c5fb4a5 Compare February 23, 2023 05:34
@knz knz requested a review from a team as a code owner February 23, 2023 05:34
@knz knz requested review from rhu713 and removed request for a team February 23, 2023 05:34
craig bot pushed a commit that referenced this pull request Feb 23, 2023
97515: sql: allow stars inside view definitions r=DrewKimball,rharding6373 a=knz

First commit from #97544.
Fixes #10028.

Release note (sql change): It is now possible to use `*` inside CREATE VIEW. The list of columns is expanded at the time the view is created, so that new columns added after the view was defined are not included in the view. This behavior is the same as PostgreSQL.

Co-authored-by: Raphael 'kena' Poss <[email protected]>
@craig craig bot merged commit c5fb4a5 into cockroachdb:master Feb 23, 2023
@knz knz deleted the 20230222-anon-subquery branch February 23, 2023 07:48
@mgartner
Copy link
Collaborator

Thanks @knz!

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.

sql: allow unaliased subqueries within UDFs
5 participants