https://bugs.documentfoundation.org/show_bug.cgi?id=174314
Bug ID: 174314
Summary: Two "?" parameters on the same field (BETWEEN ? AND ?)
are asked once and get the same value
Product: LibreOffice
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Base
Assignee: [email protected]
Reporter: [email protected]
Description:
In a parameter query, each unnamed "?" is named after the field it is
compared with. With two "?" on the same field, both get the same name, and
the parameter dialog treats them as one parameter: it asks for the value
once and uses it for both. So "date BETWEEN ? AND ?" runs as
"date BETWEEN x AND x" and returns only the rows of one date. The same
happens with "date >= ? AND date <= ?".
Named parameters work: "date BETWEEN :StartDate AND :EndDate" asks for
both values and returns the expected rows.
Reported by a user with a MariaDB database; reproduced with embedded
HSQLDB, embedded Firebird and MySQL 8.4 (direct connection).
Steps to Reproduce:
1. File > New > Database, create a new database with embedded Firebird or
HSQLDB and save it.
2. Tools > SQL, execute:
CREATE TABLE "T" ("ID" INTEGER NOT NULL PRIMARY KEY, "D" DATE);
INSERT INTO "T" VALUES (1, '2026-01-01');
INSERT INTO "T" VALUES (2, '2026-01-02');
INSERT INTO "T" VALUES (3, '2026-01-03');
INSERT INTO "T" VALUES (4, '2026-01-04');
INSERT INTO "T" VALUES (5, '2026-01-05');
Then View > Refresh Tables.
3. Create a query in SQL View and run it:
SELECT * FROM "T" WHERE "D" BETWEEN ? AND ?
4. Enter 2026-01-02 in the parameter dialog.
Actual Results:
The dialog lists one parameter and the query returns only ID 2.
Expected Results:
The dialog asks for two values. With 2026-01-02 and 2026-01-04 the query
returns IDs 2, 3 and 4.
Reproducible: Always
User Profile Reset: No
Additional Info:
Version: 27.2.0.0.alpha0+ (X86_64)
Build ID: 71d8bae33ec720e86e1928d75f919b5ca67948f4
CPU threads: 16; OS: Linux 7.0; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
--
You are receiving this mail because:
You are the assignee for the bug.