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: enable dependency tracking and support for UDFs calling other UDFs #119932

Merged
merged 4 commits into from
Mar 13, 2024

Commits on Mar 13, 2024

  1. sql: enable support for udfs calling other udfs

    Previously, we blocked the ability of one UDF to call another UDF due to
    a lack of dependency tracking. This patch removes this limitation by
    allowing user-defined functions to reference other user-defined functions
    in their bodies.
    
    Informs: cockroachdb#88198
    Release note: None
    fqazi committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    14da956 View commit details
    Browse the repository at this point in the history
  2. sql: add support for tracking UDF function dependencies

    Previously, we lacked a way to track the functions potentially invoked
    by a UDF. Consequently, only built-in functions could be called from
    within a UDF. This patch addresses this issue by adding dependency
    tracking for function calls within the optbuilder. These dependencies
    are passed to the legacy schema changer, where they are stored in the
    function descriptor. This information prevents DROP FUNCTION operations
    that would break dependent functions. Similarly, CREATE OR REPLACE
    updates and corrects these dependencies.
    
    Informs: cockroachdb#119930
    Epic: CRDB-19398
    Release note: none
    fqazi committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    5b2eb00 View commit details
    Browse the repository at this point in the history
  3. sql/schemachanger: add support for tracking function dependencies

    Previously, we did not allow user-defined functions to invoke other
    user-defined functions due to a lack of dependency tracking. This patch
    adds support for dependency tracking within the declarative schema
    changer and includes an end-to-end test to confirm correct updates to
    the descriptors.
    
    Fixes: cockroachdb#119930
    Epic: CRDB-19398
    Release note: none
    fqazi committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    09ec2c3 View commit details
    Browse the repository at this point in the history
  4. sql: drop schema can lead to dangling function references

    Previously, the DROP SCHEMA CASCADE command could leave dangling
    function references. This would cause tables or functions that
    referenced functions in the dropped schema to become unusable. The issue
    stemmed from the legacy schema changer not preventing the deletion of
    functions with cross-schema dependencies. This patch addresses the
    problem by blocking such drops from executing with a dependent object
    error.
    
    The declarative schema changer implements this cascade behaviour
    properly.
    
    Fixes: cockroachdb#120353
    Release note (bug fix): DROP SCHEMA CASCADE could lead to dangling
    function references in other schemas accessing any functions.
    fqazi committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    8972c28 View commit details
    Browse the repository at this point in the history