-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Description
What happens?
if you use postgres_query columns with too long names get truncated
and once send to copy/parquet they end up as duplicated
To Reproduce
assuming you have a pg
INSTALL postgres;
LOAD postgres;
ATTACH 'dbname=test host=db user=postgres password=postgres port=5432' AS pg (TYPE postgres, READ_ONLY);this sql will fail
COPY (
SELECT * FROM postgres_query('pg', $$
select 0 as "Gestion_des_projets_et_suivi_des_activites_internes_sur_5_derniers_mois_2025_4564654654654654",
1 as "Gestion_des_projets_et_suivi_des_activites_internes_sur_5_derniers_mois_2025_123456789123456" $$)
) TO '/tmp/tmp3e59pfxb.parquet' (FORMAT PARQUET, COMPRESSION 'ZSTD', ROW_GROUP_SIZE 10000)with
duckdb.duckdb.BinderException: Binder Error: table "postgres_query" has duplicate column name "Gestion_des_projets_et_suivi_des_activites_internes_sur_5_derni"
note this seem to work, that's why I suspect more the postgres extension/ postgres_query function to be the problem
copy (select 0 as 'Gestion_des_projets_et_suivi_des_activites_internes_sur_5_derniers_mois_2025_4564654654654654', 1 as 'Gestion_des_projets_et_suivi_des_activites_internes_sur_5_derniers_mois_2025_123456789123456' ) to 'sample.parquet' (FORMAT PARQUET);
if it might help
- the size limit is around 63 chars.
- hmm this looks related to NAMEDATALEN
- with the copy to parquet the sql fails too
SELECT * FROM postgres_query('pg', $$ select
0 as "Gestion_des_projets_et_suivi_des_activites_internes_sur_5_derniers_mois_2025_4564654654654654",
1 as "Gestion_des_projets_et_suivi_des_activites_internes_sur_5_derniers_mois_2025_123456789123456" $$)
OS:
linux
PostgreSQL Version:
16
DuckDB Version:
1.3.2
DuckDB Client:
1.3.2
Full Name:
Stéphan Mestach
Affiliation:
bluesquare
Have you tried this on the latest main branch?
- I agree
Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
- I agree
Metadata
Metadata
Assignees
Labels
No labels