Skip to content

Commit 5c1d87b

Browse files
Add test for AID collection when joining tables.
1 parent f41c108 commit 5c1d87b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

test/expected/misc.out

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,21 @@ ERROR: Column `id` is already marked as an AID.
231231
CONTEXT: PL/pgSQL function diffix.assert_column_is_not_aid(text,text) line 20 at RAISE
232232
SQL statement "CALL diffix.assert_column_is_not_aid(table_name, column_name)"
233233
PL/pgSQL function diffix.mark_filterable(text,text) line 3 at CALL
234+
-- JOIN between personal tables produces multiple AIDs
235+
EXPLAIN VERBOSE SELECT COUNT(*) FROM test_customers c JOIN test_purchases pur ON c.id = cid;
236+
QUERY PLAN
237+
--------------------------------------------------------------------------------------------
238+
Aggregate (cost=72.44..72.45 rows=1 width=8)
239+
Output: count(*)
240+
-> Hash Join (cost=28.23..66.79 rows=2260 width=0)
241+
Inner Unique: true
242+
Hash Cond: (pur.cid = c.id)
243+
-> Seq Scan on public.test_purchases pur (cost=0.00..32.60 rows=2260 width=4)
244+
Output: pur.cid, pur.pid
245+
-> Hash (cost=18.10..18.10 rows=810 width=4)
246+
Output: c.id
247+
-> Seq Scan on public.test_customers c (cost=0.00..18.10 rows=810 width=4)
248+
Output: c.id
249+
Query Identifier: 31
250+
(12 rows)
251+

test/sql/misc.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,6 @@ SELECT diffix.sum_noise(discount), diffix.count_noise(*) FROM test_customers;
108108
-- Rejects marking an AID column.
109109
CALL diffix.mark_not_filterable('test_customers', 'id');
110110
CALL diffix.mark_filterable('test_customers', 'id');
111+
112+
-- JOIN between personal tables produces multiple AIDs
113+
EXPLAIN VERBOSE SELECT COUNT(*) FROM test_customers c JOIN test_purchases pur ON c.id = cid;

0 commit comments

Comments
 (0)