Description
What happens?
The query "limit" is not being correctly applied when querying attached databases in DuckDB v1.3.0.
For instance, on one attached database table (~76k rows total), LIMIT 1
returns 22 rows, and LIMIT 2
returns 44 rows etc.
On another attached database table (~6 million rows), LIMIT 1
is returning 1726 rows and LIMIT 2
is returning 3437 rows.
This issue is happening on DuckDB v1.3.0, but not in v1.2.2, and the attached databases I have tested with are Aurora PostgreSQL 16.6 and 16.8 (I have no other DBMS's available to test on).
If this is an issue with the postgres extension, I can raise an issue there instead.
To Reproduce
LOAD postgres;
CREATE SECRET my_secret (TYPE POSTGRES, HOST 'hostname.com', PORT 5432, DATABASE 'mydbname', USER 'myuser', PASSWORD 'mypassword');
ATTACH '' AS db (TYPE POSTGRES, SCHEMA 'public', SECRET my_secret, READ_ONLY);
SELECT * FROM db.tablename LIMIT 1;
Output:
<a_table_with_more_than_1_row>
OS:
Windows 11 - WSL2 (Ubuntu 24.04.1 LTS), x86_64
DuckDB Version:
1.3.0
DuckDB Client:
CLI & Python
Hardware:
No response
Full Name:
Hanif Nasser
Affiliation:
Illuma
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a stable release
Did you include all relevant data sets for reproducing the issue?
No - I cannot share the data sets because they are confidential
Did you include all code required to reproduce the issue?
- Yes, I have
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?
- Yes, I have