Skip to content

Commit

Permalink
Fixed error with foreign tables - fixes #50
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Feb 27, 2024
1 parent c91183e commit 9e93dc1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.3 (unreleased)

- Fixed error with foreign tables

## 0.5.2 (2024-01-10)

- Added Docker image for `linux/arm64`
Expand Down
1 change: 1 addition & 0 deletions lib/dexter/indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ def database_tables
information_schema.tables
WHERE
table_catalog = current_database()
AND table_type IN ('BASE TABLE', 'VIEW')
SQL
result.map { |r| r["table_name"] }
end
Expand Down
4 changes: 4 additions & 0 deletions test/statement_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def test_materialized_view
assert_index "SELECT * FROM posts_materialized WHERE id = 1", "public.posts_materialized (id)"
end

def test_foreign_table
assert_no_index "SELECT * FROM comments WHERE post_id = 1"
end

def test_cte
assert_index "WITH cte AS (SELECT * FROM posts WHERE id = 1) SELECT * FROM cte", "public.posts (id)"
end
Expand Down
5 changes: 5 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
CREATE TABLE "Bar"."Foo"("Id" int);
INSERT INTO "Bar"."Foo" SELECT * FROM generate_series(1, 100000);
ANALYZE "Bar"."Foo";
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
CREATE SERVER IF NOT EXISTS other FOREIGN DATA WRAPPER postgres_fdw;
DROP FOREIGN TABLE IF EXISTS comments;
CREATE FOREIGN TABLE comments (post_id int) SERVER other;
SQL

class Minitest::Test
Expand Down

0 comments on commit 9e93dc1

Please sign in to comment.