Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit bb4f8c2

Browse files
committed
Added name of remote table in CREATE FOREIGN TABLE
Fix of previous commit: since now we use _fdw prefix for foreign tables, we need explicitly set name of real, remote table.
1 parent 5380e20 commit bb4f8c2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pg_shardman--0.0.1.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ BEGIN
88
-- Yes, malicious user might have another extension containing 'pg_shardman'...
99
-- Probably better just call no-op func from the library
1010
IF strpos(current_setting('shared_preload_libraries'), 'pg_shardman') = 0 THEN
11-
RAISE EXCEPTION 'pg_shardman must be loaded via shared_preload_libraries. Refusing to proceed.';
11+
RAISE EXCEPTION 'pg_shardman must be loaded via shared_preload_libraries. Refusing to
12+
proceed.';
1213
END IF;
1314
END
1415
$$;
@@ -178,12 +179,13 @@ BEGIN
178179
-- and dangerous: what if table was created and dropped before this
179180
-- change reached us?
180181

181-
EXECUTE format('CREATE FOREIGN TABLE %I %s SERVER %I',
182+
EXECUTE format('CREATE FOREIGN TABLE %I %s SERVER %I OPTIONS (table_name %L)',
182183
fdw_part_name,
183184
(SELECT
184185
shardman.reconstruct_table_attrs(
185186
format('%I', NEW.part_name))),
186-
NEW.part_name);
187+
NEW.part_name,
188+
NEW.part_name);
187189
-- Finally, replace empty local tmp partition with foreign table
188190
EXECUTE format('SELECT replace_hash_partition(%L, %L)',
189191
NEW.part_name, fdw_part_name);

0 commit comments

Comments
 (0)