Created attachment 161809 [details] Test the two forms. Press the button: different column names will be shown with the same SQL-code. Open the attached database. Open the form "form_query" and press the button. Column names of the query the form depends of are shown. But there is one column "CASE", which isn't part of the query. Now close the form and open the form with the same SQL code. The code is direcly connected to the form, not through a query. Press the button and you could see the column names. This column names are the same as shown in the query. This is the query: SELECT "ID", "forename", "sex" "s_short", CASE WHEN "sex" = 'm' THEN 'Mister' ELSE 'Miss' END "sex" FROM "table1" The bug only appears if there is a field, which is defined in the table with the same name as another field gets for alias. Table contains "sex", which is changed by alias to "s_short" and then another field appears with alias "sex". The bug appears with queries, but not with SQL-code, which is set directly in the form. Might be related to https://bugs.documentfoundation.org/show_bug.cgi?id=132924
Confirming with Version : 6.4.4.2 Build ID : 3d775be2011f3886db32dfd395a6a6d1ca2630ff Threads CPU : 8; OS : Mac OS X 10.15.5; UI Render : par défaut; VCL: osx; Locale : fr-FR (fr_FR.UTF-8); Langue IHM : fr-FR Calc: threaded
Seems like the parser can't handle the CASE WHEN statement and just segments after the first space taking CASE as the column name. Could be that this is indeed a DUP of bug 1329294.
Comment on attachment 161809 [details] Test the two forms. Press the button: different column names will be shown with the same SQL-code. I experienced identical behaviour and like to strengthen Alex Thurgoods vision. In a base query with SQL ( excerpt: CURRENT_DATE AS "datum", 'F' || "IDgbwriter" || "volgnr" AS "filenaam", ( "tblgb"."gb" - TRUNC( "tblgb"."gb", - 2 ) ) * 1000 + "volgnr" AS "factuurnummer") the aliases are correctly displayed in the query GUI, however the same SQL string in a basic macro evaluated with the PrepareStatement( stringSQL ) and executeQuery()shows that the given alias names are ignored, and reassigned as "CURRENT_DATE" , ADD3 , CONCAT and the like.
Should be fixed with Bug 132924. *** This bug has been marked as a duplicate of bug 132924 ***