-
Notifications
You must be signed in to change notification settings - Fork 590
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
udf: drop function
should perform dependency check
#17263
Comments
+1. Today I was asked by a user, too. The behavior is confusing to users. The "Expected behavior" mentioned in the PR is better to me. |
The current behavior is that UDFs can be dropped without any dependency check. Materialized views which are using these UDFs will not be affected, because the UDF body has been embedded into the MVs. I agree that this is not intuitive to users and a dependency check should be added before dropping. However, the example shown above is not related to this issue.
The reason of the empty output is that
(Unfortunately, due to the nature of Python language, it's hard for us to ensure the source code is workable on creation.) A correct reproducible example of this issue should be: dev=> create table t (a int, b int);
CREATE_TABLE
dev=> CREATE FUNCTION add(a int, b int) RETURNS int LANGUAGE python AS $$
dev$> def add(a, b):
dev$> return a+b
dev$> $$;
CREATE_FUNCTION
dev=> create materialized view mv as select add(a, b) as c from t; CREATE_MATERIALIZED_VIEW
dev=> drop function add;
DROP_FUNCTION
dev=> insert into t values (1,1), (2,2), (3,3);
INSERT 0 3
dev=> select * from mv;
c
---
4
2
6
(3 rows) Expected behavior like postgres: postgres=# drop function add;
ERROR: cannot drop function add(integer,integer) because other objects depend on it
DETAIL: materialized view mv depends on function add(integer,integer) |
BTW, similar things apply to logical |
Sorry for giving the incorrect example. |
drop function
should perform dependency check
drop function
should perform dependency checkdrop function
should perform dependency check
This issue has been open for 60 days with no activity. If you think it is still relevant today, and needs to be done in the near future, you can comment to update the status, or just manually remove the You can also confidently close this issue as not planned to keep our backlog clean. |
Requested by user today. |
Describe the bug
Currently, the DROP FUNCTION command does not check whether the function has dependencies with materialized views or sinks. This could cause undefined behaviors.
Error message/log
No response
To Reproduce
After the UDF
add
is dropped, all subsequent changes made to the MV fail to produce correct results.Expected behavior
drop function
should perform dependency checks and fail with errors when dependencies exist.How did you deploy RisingWave?
No response
The version of RisingWave
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: