+1
Planned

Update columns in view fails to determin type for CASE expression

Tomasz Traczyk 4 years ago • updated by Agnieszka Kozubek-Krycuń (Chief Scientist) 4 years ago 1
In my model I have a view using the CASE expression for some column, like this:

SELECT
(...)
CASE WHEN <some condition> THEN b.name
ELSE c.name
END AS name
(...)

When I click the Update columns button, column name is constantly interpreted as int, while both b.name and c.name are varchar (in fact in my case they even refer to the same column of the same table).

I suppose it might be difficult in general to reason about the desired type of case expression, but as for me, silently assuming that it's int, without any warring is a bug.

I've fixed the type manually sometime ago, then today I've added some new columns to my view and then, not remembering about the issue, hit "Update columns", which silently broke my model. I'd rather get an error, that Vertabelo is unable to update columns.

Planned
You're right. We'll try to fix this, or at least give warning, as you suggest.