Bug 167933 - Libreoffice Base SQL parser does not understand WITH ROLLUP statement
Summary: Libreoffice Base SQL parser does not understand WITH ROLLUP statement
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Queries
  Show dependency treegraph
 
Reported: 2025-08-13 11:08 UTC by Nikos
Modified: 2026-01-24 10:38 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikos 2025-08-13 11:08:46 UTC
Description:
The following query in a single table mysql database works when send directly to MariaDB, but not when send via the parser:

SELECT `ANK`.`company`, `ANK`.`journal`,`ANK`.`pb`, `ANK`.`db`, `DEUTERO`.`dbdesc`, SUM( CASE WHEN `ANK`.`year` = 2024 THEN `ANK`.`dc` END ) AS `T`, SUM( CASE WHEN `ANK`.`year` = 2024 - 1 THEN `ANK`.`dc` END ) AS `T_prev`, SUM( CASE WHEN `ANK`.`year` = 2024 THEN `ANK`.`dc` END ) - SUM( CASE WHEN `ANK`.`year` = 2024 - 1 THEN `ANK`.`dc` END ) AS `Diff`, ( SUM( CASE WHEN `ANK`.`year` = 2024 THEN `ANK`.`dc` END ) / NULLIF ( SUM( CASE WHEN `ANK`.`year` = 2024 - 1 THEN `ANK`.`dc` END ), 0 ) - 1 ) AS `Percent` FROM `ANK` LEFT JOIN `DEUTERO` ON `ANK`.`db` = `DEUTERO`.`db` WHERE `ANK`.`year` >= 2024 - 1 AND `company` = 'VD' AND `ANK`.`omada` = '6' AND `ANK`.`month` <= 12 AND `ANK`.`journal` = 'ΓΗ' GROUP BY `ANK`.`pb`, `ANK`.`db` WITH ROLLUP

The reason is the usage of WITH ROLLUP in the GROUP BY statement.
However, as I would like to use parameters, I would like to use the parser.

Steps to Reproduce:
1. Connect to a MariaDB or MySQL database
2. Write a query with a WITH ROLLUP in the GROUP BY statement. 
3. Send it via the parser

Actual Results:
Syntax error

Expected Results:
The requested query


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 25.2.5.2 (X86_64) / LibreOffice Community
Build ID: 03d19516eb2e1dd5d4ccd751a0d6f35f35e08022
CPU threads: 12; OS: Linux 6.14; UI render: default; VCL: gtk3
Locale: el-GR (en_US.UTF-8); UI: en-US
Flatpak
Calc: threaded
Comment 1 Robert Großkopf 2025-11-26 07:25:02 UTC
Could confirm "WITH ROLLUP" is only working in direct SQL mode. Like other special commands this is a command not used in internal databases.

Would be a good idea to support this function.

Have a look also to https://bugs.documentfoundation.org/show_bug.cgi?id=166303 - other commands only known in direct SQL for MariaDB.