Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

When I use postgres_scan an exception occurs: permission denied for table

Open
#177 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, postgresql, sql
Domain
databases

Research direction

Start by reproducing the postgres_scan query from the report against PostgreSQL using DuckDB 0.9.2 or the main build, including the table's column restrictions. Inspect the postgres_scan implementation and compare its COPY-based access with a direct PostgreSQL SELECT. Done means the reported query works with the stated permissions, or the limitation and required privileges are clearly documented.

Written by the indexing model from the issue text.

Description

What happens?

I am using Quickdb 0.9.2.

In my SQL script, I call the postgres_scan command.

I specify the correct data for the connection: host, port, user, and so on. (I checked on other tables).

When I want to make a typical request:

SELECT
    user_id
FROM 
    postgres_scan('host=**** port=**** dbname=**** user=**** password=****', 'public', 'some_table')
LIMIT 10

I'm getting an error:

SQL Error: Invalid Error: Failed to prepare COPY "
	COPY (SELECT "user_id" FROM "public"."some_table" WHERE id BETWEEN '(0,0)'::tid AND '(1000,0)'::tid) TO STDOUT (FORMAT binary);
	": ERROR:  permission denied for table some_table.

But the table allows you to get data from it while working with it through PostgreSQL itself.

Remark: In the table, there is a viewing limit for some columns. Perhaps the problem is related to this moment?

To Reproduce
  1. You need to install DuckDB 0.9.2
  2. Run the postgres_scan command on a regular SELECT
  3. Get an error
  4. If there is no error, then check the constraints on the table (columns) and run SELECT again
OS:

MacOS 14.2.1 (23C71)

DuckDB Version:

0.9.2

DuckDB Client:

DBeaver

Full Name:

Ivan Korsakov

Affiliation:

By yourself

Have you tried this on the latest main branch?

I have tested with a main build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
  • Yes, I have
Dominant language
C++
Stars
375
Forks
113
Avg merge
5h 32m
Merged PRs (30d)
36

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

  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 duckdb/duckdb-postgres

All issues in duckdb/duckdb-postgres

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.