@@ -20,6 +20,14 @@ CREATE REFERENCE TABLE test_ref_rel;
2020 shard id -> sh1,sh2,sh3,sh4
2121(2 rows)
2222
23+ -- test schema-qualified creation
24+ CREATE REFERENCE TABLE sh1.test_ref_rel_rel;
25+ create reference table
26+ ------------------------------
27+ table -> test_ref_rel_rel
28+ shard id -> sh1,sh2,sh3,sh4
29+ (2 rows)
30+
2331-- partial ref relation test
2432CREATE REFERENCE RELATION test_ref_rel_part ON sh1, sh3;
2533 create reference table
@@ -62,12 +70,18 @@ CREATE KEY RANGE kr1 FROM 0 ROUTE TO sh1 FOR DISTRIBUTION ds1;
6270\c regress
6371CREATE TABLE test_ref_rel(i int, j int);
6472NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
73+ CREATE SCHEMA sh1;
74+ NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
75+ CREATE TABLE sh1.test_ref_rel_rel(i int, j int);
76+ NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
6577CREATE TABLE test_distr_ref_rel(id int, val int);
6678NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
6779CREATE TABLE test_ref_rel_part(i int, j int);
6880NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
6981COPY test_ref_rel FROM STDIN;
7082NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
83+ COPY sh1.test_ref_rel_rel FROM STDIN;
84+ NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
7185COPY test_ref_rel_part FROM STDIN;
7286NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
7387COPY test_distr_ref_rel(id, val) FROM STDIN WITH DELIMITER '|';
@@ -100,6 +114,8 @@ WITH data(x,z) AS (VALUES(1,3)) INSERT INTO test_ref_rel SELECT * FROM data;
100114NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
101115INSERT INTO test_ref_rel SELECT 1 /* __spqr__engine_v2: true */;
102116NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
117+ INSERT INTO sh1.test_ref_rel_rel SELECT 1 /* __spqr__engine_v2: true */;
118+ NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
103119SELECT * FROM test_ref_rel ORDER BY i, j /*__spqr__execute_on: sh1 */;
104120NOTICE: send query to shard(s) : sh1
105121 i | j
@@ -152,6 +168,50 @@ NOTICE: send query to shard(s) : sh4
152168 4 | 5
153169(7 rows)
154170
171+ SELECT * FROM sh1.test_ref_rel_rel ORDER BY i, j /*__spqr__execute_on: sh1 */;
172+ NOTICE: send query to shard(s) : sh1
173+ i | j
174+ ---+---
175+ 1 | 2
176+ 1 |
177+ 2 | 3
178+ 3 | 4
179+ 4 | 5
180+ (5 rows)
181+
182+ SELECT * FROM sh1.test_ref_rel_rel ORDER BY i, j /*__spqr__execute_on: sh2 */;
183+ NOTICE: send query to shard(s) : sh2
184+ i | j
185+ ---+---
186+ 1 | 2
187+ 1 |
188+ 2 | 3
189+ 3 | 4
190+ 4 | 5
191+ (5 rows)
192+
193+ SELECT * FROM sh1.test_ref_rel_rel ORDER BY i, j /*__spqr__execute_on: sh3 */;
194+ NOTICE: send query to shard(s) : sh3
195+ i | j
196+ ---+---
197+ 1 | 2
198+ 1 |
199+ 2 | 3
200+ 3 | 4
201+ 4 | 5
202+ (5 rows)
203+
204+ SELECT * FROM sh1.test_ref_rel_rel ORDER BY i, j /*__spqr__execute_on: sh4 */;
205+ NOTICE: send query to shard(s) : sh4
206+ i | j
207+ ---+---
208+ 1 | 2
209+ 1 |
210+ 2 | 3
211+ 3 | 4
212+ 4 | 5
213+ (5 rows)
214+
155215UPDATE test_ref_rel SET i = i + 1 /* __spqr__engine_v2: true */;
156216NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
157217UPDATE test_ref_rel SET i = - i WHERE i IN (3, 4) /* __spqr__engine_v2: true */;
@@ -360,6 +420,10 @@ NOTICE: send query to shard(s) : sh3
360420
361421DROP TABLE test_ref_rel;
362422NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
423+ DROP TABLE sh1.test_ref_rel_rel;
424+ NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
425+ DROP SCHEMA sh1;
426+ NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
363427DROP TABLE test_ref_rel_part;
364428NOTICE: send query to shard(s) : sh1,sh2,sh3,sh4
365429DROP TABLE test_distr_ref_rel;
@@ -377,7 +441,8 @@ SHOW reference_relations;
377441-------------------+----------------+-------------------
378442 test_ref_rel | 1 | [sh1 sh2 sh3 sh4]
379443 test_ref_rel_part | 1 | [sh1 sh3]
380- (2 rows)
444+ test_ref_rel_rel | 1 | [sh1 sh2 sh3 sh4]
445+ (3 rows)
381446
382447DROP DISTRIBUTION ALL CASCADE;
383448 drop distribution
0 commit comments