"! Multiple queries must use the same column names." when issuing a query against a Postgres server running with the pg_duckdb extension

Open
#526 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
postgresql, r
Domain
database

Research direction

Start by reproducing the two DBI::dbGetQuery() calls against the stated pg_duckdb container, then inspect the RPostgres::dbSendQuery() and RPostgres:::result_create paths named in the traceback. Compare the behavior with the PostgreSQL CLI example and establish whether the failure belongs to RPostgres or pg_duckdb; done means the responsible component and expected handling are identified.

Written by the indexing model from the issue text.

Description

Working with RPostgres against a postgres server with the pg_duckdb extension running in a container (image: pgduckdb/pgduckdb:17-v1.0.0), I can successfully make a connection and count the number of records in a parquet file:

> library(RPostgres); library(DBI);
> con <- dbConnect(
    drv = RPostgres::Postgres(), 
    host = "<redacted>", 
    user = "<redacted>",
    password = "<redacted>", 
    dbname = "<redacted>"
  )
> "SELECT count(*) FROM read_parquet('s3://us-prd-motherduck-open-datasets/netflix/netflix_daily_top_10.parquet')" |> 
+   dbGetQuery(conn = con)
  count
1  7100

When issuing another query to get the data in the file (this query works using pgsql) I get:

> "SELECT * FROM read_parquet('s3://us-prd-motherduck-open-datasets/netflix/netflix_daily_top_10.parquet')" |> 
+   dbGetQuery(conn = con)
Error:
! Multiple queries must use the same column names.
Hide Traceback
     ▆
  1. ├─DBI::dbGetQuery(...)
  2. └─DBI::dbGetQuery(...)
  3.   └─DBI (local) .local(conn, statement, ...)
  4.     ├─DBI::dbSendQuery(conn, statement, ...)
  5.     └─RPostgres::dbSendQuery(conn, statement, ...)
  6.       └─RPostgres (local) .local(conn, statement, ...)
  7.         ├─methods::new(...)
  8.         │ ├─methods::initialize(value, ...)
  9.         │ └─methods::initialize(value, ...)
 10.         └─RPostgres:::result_create(conn@ptr, statement, immediate) 

I am not sure if this is an issue with the pg_duckdb extension for Postgres or whether I haven't understood how to use it properly, but since the same query works in pgsql CLI I was thinking maybe it could be related to RPostgres.

Dominant language
R
Stars
343
Forks
82
Avg merge
11h 26m
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-dbi/RPostgres

All issues in r-dbi/RPostgres

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.