Skip to content

sql: udf already being dropped in local-legacy-schema-changer #96368

@rharding6373

Description

@rharding6373

Describe the problem

During a drop column cascade, there's an error that one of the UDFs is already being dropped.

To Reproduce

In a logic test using the local-legacy-schema-changer configuration, the following statements result in the error. The ordering and/or quantity of UDFs seems important to reproducing the error.

statement ok
CREATE TABLE t_twocol (a INT, b INT);

statement ok
CREATE FUNCTION f_unqualified_twocol() RETURNS t_twocol AS
$$
  SELECT t_twocol.a, t_twocol.b FROM t_twocol;
$$ LANGUAGE SQL;

statement ok
CREATE FUNCTION f_allcolsel_alias() RETURNS t_twocol AS
$$
  SELECT t1.a, t1.b FROM t_twocol AS t1, t_twocol AS t2 WHERE t1.a = t2.a;
$$ LANGUAGE SQL;

statement ok
CREATE FUNCTION f_tuplestar() RETURNS t_twocol AS
$$
  SELECT t_twocol.a, t_twocol.b FROM t_twocol;
$$ LANGUAGE SQL;

# This statement should be ok but fails
statement ok
ALTER TABLE t_twocol DROP COLUMN b CASCADE;

Error in output:

expected success, but found
(XXUUU) function "f_tuplestar" is already being dropped
drop_function.go:167: in dropFunctionImpl()

Expected behavior
I expect the DROP to succeed and all the functions to be dropped as part of the cascade.

Jira issue: CRDB-24090

Metadata

Metadata

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.GA-blockerT-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)branch-release-23.1Used to mark GA and release blockers, technical advisories, and bugs for 23.1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions