Skip to content

Conversation

@ggnmstr
Copy link
Contributor

@ggnmstr ggnmstr commented Jan 2, 2026

resolves #1000

Copilot AI review requested due to automatic review settings January 2, 2026 12:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where the ContainsPostgresTable function was incorrectly triggering on database views. The fix adds a check to skip views when determining if a query contains Postgres tables.

Key Changes

  • Updated duckdb submodule to a newer commit
  • Added filtering logic to exclude views (RELKIND_VIEW) from Postgres table detection

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
third_party/duckdb Updated submodule commit reference
src/pgduckdb_hooks.cpp Added view detection to skip views in ContainsPostgresTable function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (rte->relid == InvalidOid) {
continue;
}
char relkind = get_rel_relkind(rte->relid);
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function get_rel_relkind can return 0 if the relation OID is invalid or the relation doesn't exist. This should be checked before comparing against RELKIND_VIEW to avoid silently skipping error cases. Consider adding a check for relkind == 0 and handling it appropriately.

Suggested change
char relkind = get_rel_relkind(rte->relid);
char relkind = get_rel_relkind(rte->relid);
/* get_rel_relkind() returns 0 if the relation does not exist or OID is invalid.
* Treat such cases as Postgres tables to avoid silently skipping an error. */
if (relkind == 0) {
return true;
}

Copilot uses AI. Check for mistakes.
@ggnmstr ggnmstr force-pushed the contains-pg-table-skip-view branch from 87530ef to de3645f Compare January 2, 2026 13:00
@JelteF JelteF merged commit dafe12d into duckdb:main Jan 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ContainsPostgresTable triggers on parquet-underlying views

2 participants