nikelborm commented on issue #30977:
URL: https://github.com/apache/superset/issues/30977#issuecomment-2556315263

   I have a query that also triggered the error.
   
   ```sql
   create or replace view view_investors_payouts as
   SELECT
     any_value(party.name) as "Имя инвестора",
     coalesce(abs(sum(case when 
monetary_delta_required_to_compensate_difference < 0 AND re_cf.currency_code = 
'₽' then monetary_delta_required_to_compensate_difference end)), 0) as "Мы 
должны ₽",
     coalesce(abs(sum(case when 
monetary_delta_required_to_compensate_difference > 0 AND re_cf.currency_code = 
'₽' then monetary_delta_required_to_compensate_difference end)), 0) as "Нам 
должны ₽",
     coalesce(abs(sum(case when           
expected_monetary_delta_of_our_balance < 0 AND re_cf.currency_code = '₽' then 
expected_monetary_delta_of_our_balance           end)), 0) as "Ожидаемые 
расходы ₽",
     coalesce(abs(sum(case when           
expected_monetary_delta_of_our_balance > 0 AND re_cf.currency_code = '₽' then 
expected_monetary_delta_of_our_balance           end)), 0) as "Ожидаемые доходы 
₽",
     coalesce(abs(sum(case when               
real_monetary_delta_of_our_balance < 0 AND re_cf.currency_code = '₽' then     
real_monetary_delta_of_our_balance           end)), 0) as "Реальные расходы ₽",
     coalesce(abs(sum(case when               
real_monetary_delta_of_our_balance > 0 AND re_cf.currency_code = '₽' then     
real_monetary_delta_of_our_balance           end)), 0) as "Реальные доходы ₽",
   
     coalesce(abs(sum(case when re_cf.currency_code = '₽' then 
expected_monetary_delta_of_our_balance end)), 0) as "Ожидаемая дельта нашего 
баланса ₽",
     coalesce(abs(sum(case when re_cf.currency_code = '₽' then     
real_monetary_delta_of_our_balance end)), 0) as "Реальная дельта нашего баланса 
₽"
   
   from view_real_and_expected_cash_flows as re_cf
   join party_involved_in_deal using (deal_id)
   join party using (party_id)
   where reason_from_db in ('investment', 'profit_payouts')
   group by party_id
   ;
   ```
   
   I guess it doesn't like spaces inside the column names instead of disliking 
`on`.
   
   Because as soon as I changed it to this:
   
   ```sql
   create or replace view view_investors_payouts as
   SELECT
     any_value(party.name) as investor_name,
     coalesce(abs(sum(case when 
monetary_delta_required_to_compensate_difference < 0 AND re_cf.currency_code = 
'₽' then monetary_delta_required_to_compensate_difference end)), 0) as 
we_owe_rubles,
     coalesce(abs(sum(case when 
monetary_delta_required_to_compensate_difference > 0 AND re_cf.currency_code = 
'₽' then monetary_delta_required_to_compensate_difference end)), 0) as 
they_owe_rubles,
     coalesce(abs(sum(case when           
expected_monetary_delta_of_our_balance < 0 AND re_cf.currency_code = '₽' then 
expected_monetary_delta_of_our_balance           end)), 0) as 
expected_expenses_rubles,
     coalesce(abs(sum(case when           
expected_monetary_delta_of_our_balance > 0 AND re_cf.currency_code = '₽' then 
expected_monetary_delta_of_our_balance           end)), 0) as 
expected_income_rubles,
     coalesce(abs(sum(case when               
real_monetary_delta_of_our_balance < 0 AND re_cf.currency_code = '₽' then     
real_monetary_delta_of_our_balance           end)), 0) as real_expenses_rubles,
     coalesce(abs(sum(case when               
real_monetary_delta_of_our_balance > 0 AND re_cf.currency_code = '₽' then     
real_monetary_delta_of_our_balance           end)), 0) as real_income_rubles,
   
     coalesce(abs(sum(case when re_cf.currency_code = '₽' then 
expected_monetary_delta_of_our_balance end)), 0) as 
expected_delta_to_our_balance_rubles,
     coalesce(abs(sum(case when re_cf.currency_code = '₽' then     
real_monetary_delta_of_our_balance end)), 0) as real_delta_to_our_balance_rubles
   
   from view_real_and_expected_cash_flows as re_cf
   join party_involved_in_deal using (deal_id)
   join party using (party_id)
   where reason_from_db in ('investment', 'profit_payouts')
   group by party_id
   ;
   ```
   
   It started working flawlessly and doesn't require increasing potential 
attack surface, by enabling feature flag


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to