I have a query I would like as a view in MariaDB 10.3(win), however when I attempt to create such view it is being changed to a different (and incorrect) one, removing parentheses:
create or replace view v_ReceiptSumByVAT
as
select VAT, SUM(RetailPrice) / (1 + VAT) as Sum from ReceiptItem
group by VAT
when I run the SELECT VIEW_DEFINITION later, the returned query is (note missing parentheses near VAT)
select VAT, SUM(RetailPrice) / 1 + VAT as Sum from ReceiptItem
group by VAT
which gives different results than the original SELECT query - A / 1 + B is not equal to A / (1 + B) !
I have found a similar question why mysql change my code view? that however deals with MySql and the query being changed to equivalent, not a different one. How can I ensure the view gets created correctly?