Silent switching from binary to text copy
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start by tracing the pg_use_binary_copy setting and the COPY format selection used when inserting into PostgreSQL. Reproduce the NUMERIC and FLOAT cases from the issue with pg_debug_show_queries enabled, then verify that the NUMERIC case follows the intended binary-copy behavior without regressing the existing FLOAT case.
Written by the indexing model from the issue text.
Description
What happens?
Despite having set pg_use_binary_copy=true, if the target table has a column with NUMERIC type then text format is used (instead of binary) when copying data from DuckDB to PostgreSQL.
To Reproduce
-
Configure
duckdb-postgresas follows:SET pg_debug_show_queries=true;SET pg_use_binary_copy=true;
-
Create a DuckDB table:
CREATE OR REPLACE TABLE mytable (id INTEGER, value NUMERIC);. -
Insert a row into the table created at step 2:
INSERT INTO mytable VALUES (1, 1.234);. -
Open a connection to PostgreSQL:
ATTACH 'dbname=<dbname> user=<user> password=<password> host=<host>' AS pg (TYPE postgres);. -
Create a PostgresSQL table:
CALL postgres_execute('pg', ' DROP TABLE IF EXISTS mytable; CREATE TABLE mytable ( id INTEGER, value NUMERIC );' ); -
Copy data from DuckDB to PostgreSQL:
INSERT INTO pg.mytable (id, value) SELECT id, value FROM mytable;. The following line would show up in debug messages:COPY "public"."mytable" FROM STDIN (FORMAT TEXT, NULL '). -
Repeat step 5 by replacing
NUMERICwithFLOAT. -
Repeat step 6. Now, data would be copied using the binary format (debug message:
COPY "public"."mytable" ("id", "value") FROM STDIN (FORMAT BINARY)).
OS:
Debian 12
PostgreSQL Version:
17.5
DuckDB Version:
v1.4.0-dev2508
DuckDB Client:
Python
Full Name:
Alessandro Cerioni
Affiliation:
État de Genève
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
- Dominant language
- C++
- Stars
- 375
- Forks
- 113
- Avg merge
- 6h 42m
- Merged PRs (30d)
- 30
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from duckdb/duckdb-postgres
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
duckdb/duckdb-postgres#623 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
duckdb/duckdb-postgres#618 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
duckdb/duckdb-postgres#594 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
duckdb/duckdb-postgres#575 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
duckdb/duckdb-postgres#564 · 1 comment ·
Maintainers usually reply within 1 day
All issues in duckdb/duckdb-postgres
Similar issues
-
enhancement GUI maintainer-review
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
aethersdr/AetherSDR#6681 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
area: ui bug good first issue P2: medium value: medium
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
patrick-hudson/put.gd-desktop#366 ·
Maintainers usually reply within 1 day