[Bug]: can not alter table
What happened?
Hi
I ran the following SQL, but I got an error message. However, these SQL statements can be executed normally in SQL Server.
create table test(a nvarchar(10),b int);
create view v_test as select * from test;
alter table test alter column a nvarchar(20);
message: can not alter type of a column used by a view or rule
Version
BABEL_5_X_DEV (Default)
Extension
None
Which flavor of Linux are you using when you see the bug?
No response
Relevant log output
Code of Conduct
- [x] I agree to follow this project's Code of Conduct.
PostgreSQL only supports what SQL Server would call WITH SCHEMABINDING. So a T-SQL view that is not specifying the SCHEMABINDING keyword is created as if SCHEMABINDING was specified (the Compass report indicates this). This aspect of T-SQL has not yet been addressed by Babelfish.
We did add a limited support for weak binded views in babelfish https://github.com/babelfish-for-postgresql/babelfish_extensions/commit/012882bd4265f35394342d4edcd6629b5e9095c3
In future we could support ALTER TABLE ALTER COLUMN when columns have dependant weak views.