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

workload: add UDFs calling other UDFs to schemachange workload #120671

Closed
rafiss opened this issue Mar 18, 2024 · 0 comments · Fixed by #121219
Closed

workload: add UDFs calling other UDFs to schemachange workload #120671

rafiss opened this issue Mar 18, 2024 · 0 comments · Fixed by #121219
Assignees
Labels
A-random-schema-change-workload C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@rafiss
Copy link
Collaborator

rafiss commented Mar 18, 2024

Is your feature request related to a problem? Please describe.
Now that UDFs can call other UDFs (#119930), we should test that in the random schemachange workload.

Describe the solution you'd like
Add it here, as another "body ref" similar to how tables and enums can be referenced:

possibleBodyReferences = append(possibleBodyReferences, fmt.Sprintf(`((SELECT count(*) FROM %s LIMIT 0) = 0)`, table))

Jira issue: CRDB-36812

Epic CRDB-19398

@rafiss rafiss added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) A-random-schema-change-workload labels Mar 18, 2024
@blathers-crl blathers-crl bot added this to Triage in SQL Foundations Mar 18, 2024
@fqazi fqazi moved this from Triage to In Flight in SQL Foundations Mar 25, 2024
craig bot pushed a commit that referenced this issue Mar 28, 2024
121219: workload/schemachange: support UDFs invoking other UDFs r=fqazi a=fqazi

This patch adds support for the schema change workload to create UDF's which invoke other UDF's, which will need the following:

1. Extend pg_depend to support tracking UDF references to other UDFs. This is an extension from Postgres behaviour where classid will refer to the pg_proc table.
2. Update the schema changer workload to create include UDF references when creating functions
3. Modify the schema changer workload to ensure that DROP / RENAME FUNCTION operations on these functions check for references to other functions, which will cause the operation to fail.
4. Modify the schema changer workload to ensure that DROP SCHEMA with the legacy schema changer will properly block operations if references exist from a different schema.

Fixes: #120671


Co-authored-by: Faizan Qazi <faizan@cockroachlabs.com>
@craig craig bot closed this as completed in 826ee6e Mar 28, 2024
SQL Foundations automation moved this from In Flight to Done Mar 28, 2024
blathers-crl bot pushed a commit that referenced this issue Mar 28, 2024
Previously, the randomized schema changer workload only created routines
that referred to types or tables. Since we added support for UDFs
calling other UDFs we need to add support. To address this, this patch
adds support for creating UDFs that can refer/invoke to other UDFs.

Fixes: #120671

Release note: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-random-schema-change-workload C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
Development

Successfully merging a pull request may close this issue.

2 participants