Skip to content

sql: disallow star expressions in UDF bodies#90085

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
mgartner:86070-disable-star
Oct 18, 2022
Merged

sql: disallow star expressions in UDF bodies#90085
craig[bot] merged 1 commit intocockroachdb:masterfrom
mgartner:86070-disable-star

Conversation

@mgartner
Copy link
Copy Markdown
Contributor

@mgartner mgartner commented Oct 17, 2022

This commit disallows star expressions in UDF bodies (see the release
note below). It also fixes an error message returned when trying to
create a view that references non-existent columns that incorrectly
mentioned star expressions.

Fixes #86070

Release note (sql change): Star expressions, e.g., SELECT * FROM ...
are no longer allowed in statements in user-defined functions. They were
allowed in early betas of v22.2 from v22.2.0-beta.1 to v22.2.0-beta.4,
but have been disallowed because they do not behave correctly.
Issue #90080 tracks re-enabling star expressions in UDFs.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner, @chengxiong-ruan, and @mgartner)


pkg/sql/logictest/testdata/logic_test/views line 50 at r1 (raw file):


statement error pgcode 42703 column \"j\" does not exist
CREATE VIEW err AS SELECT a FROM t WHERE a = j

Are these tests related to this change? (They are fine, just wondering...)

@mgartner
Copy link
Copy Markdown
Contributor Author

pkg/sql/logictest/testdata/logic_test/views line 50 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

Are these tests related to this change? (They are fine, just wondering...)

Oops, forgot to mention this in the commit message - fixed. I ran into a confusing error message with views that is now fixed too.

Copy link
Copy Markdown
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner and @chengxiong-ruan)

This commit disallows star expressions in UDF bodies (see the release
note below). It also fixes an error message returned when trying to
create a view that references non-existent columns that incorrectly
mentioned star expressions.

Fixes cockroachdb#86070

Release note (sql change): Star expressions, e.g., `SELECT * FROM ...`
are no longer allowed in statements in user-defined functions. They were
allowed in early betas of v22.2 from v22.2.0-beta.1 to v22.2.0-beta.4,
but have been disallowed because they do not behave correctly.
Issue cockroachdb#90080 tracks re-enabling star expressions in UDFs.
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! Thanks for working on this.

@mgartner
Copy link
Copy Markdown
Contributor Author

TFTRs!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Oct 18, 2022

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.

udf: select * in a udf combined with edited table can cause crashes

4 participants