Skip to content

Commit dafe12d

Browse files
authored
fix: do not trigger on views in ContainsPostgresTable (#1001)
resolves #1000
1 parent fb89c4b commit dafe12d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/pgduckdb_hooks.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern "C" {
2020
#include "tcop/pquery.h"
2121
#include "utils/rel.h"
2222
#include "utils/relcache.h"
23+
#include "utils/lsyscache.h"
2324
#include "optimizer/optimizer.h"
2425
#include "optimizer/planner.h"
2526
}
@@ -154,6 +155,11 @@ ContainsPostgresTable(Node *node, void *context) {
154155
if (rte->relid == InvalidOid) {
155156
continue;
156157
}
158+
char relkind = get_rel_relkind(rte->relid);
159+
if (relkind == RELKIND_VIEW) {
160+
/* Any tables referenced in the view will also be in the rtable */
161+
continue;
162+
}
157163
if (!::IsDuckdbTable(rte->relid)) {
158164
return true;
159165
}

0 commit comments

Comments
 (0)