Open avorobjovs opened 4 years ago
Thank you for creating the issue! One of our team members will get back to you shortly with additional information. If this is a product issue, please close this and contact the particular product's support instead (see https://support.microsoft.com/allproducts for the list of support websites).
Currently, we have two workarounds.
1. The first workaround You need to explicitly specify columns that you insert to the View.
2. The second workaround As we realized, this issue happens only with a View on only one table. If the View is on several tables or data sources, this issue doesn't happen. So, the second workaround is to add a second fake table to the Updatable View. For example,
CREATE VIEW [graph].[in_user] AS
SELECT [Login]
,[FirstName]
,[LastName]
FROM [graph].[user], (SELECT 0 as fix_col) fix_tbl
GO
In this case, these two Node system columns (graphid
And it allows successfully inserting data to the View.
Describe the bug
It means that when we insert data to this View, the INSTEAD OF INSERT trigger checks this data and inserts a new row to the Node table or updates an existing one. In our Updatable Views, we select only those columns from the source Node tables that we need and can update. Previously, it worked fine.
But unexpectedly (we noticed it on November 12), some new behavior of the Azure SQL Database happens.
If we create a new Updatable View or alter the existing one, to starts automatically expose additional, not selected, unwanted columns from the source Node tables: graphid and objid .
And this behavior completely breaks our solution. Now, when we try to insert data in our Updatable Views, we have the error: "Column name or number of supplied values does not match table definition".
It is because there are two more columns (graphid and objid) in our Updatable Views. And the View requires data for them. But we cannot provide such data because they are Node table's system columns.
And we didn't modify our View's code, we didn't add these columns, we don't want to use them anyhow. These columns appear automatically and we don't know how to say the Azure SQL Database to not use them in Views.
To Reproduce
CREATE TRIGGER [graph].[TG_IN_USER] ON [graph].[in_user] INSTEAD OF INSERT AS BEGIN
END; GO
INSERT INTO [graph].[in_user] VALUES ('BOB', 'Robert', 'Green') GO