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

Commit b21a5d7

Browse files
committed
Fixed altering fdw server.
"ADD" is default option, so we don't need it at all anyway.
1 parent 7acdef8 commit b21a5d7

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

shard.sql

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@ BEGIN
486486

487487
SELECT nodes.connstring FROM shardman.nodes WHERE id = part.owner
488488
INTO connstring;
489-
SELECT * FROM shardman.conninfo_to_postgres_fdw_opts(connstring, 'ADD ')
490-
INTO server_opts, um_opts;
489+
SELECT * FROM shardman.conninfo_to_postgres_fdw_opts(connstring)
490+
INTO server_opts, um_opts;
491491

492492
-- ALTER FOREIGN TABLE doesn't support changing server, ALTER SERVER doesn't
493493
-- support dropping all params, and I don't want to recreate foreign table
@@ -582,11 +582,9 @@ END $$ LANGUAGE plpgsql;
582582
-- have C function which parses the opts and returns them in two parallel
583583
-- arrays, and this sql function joins them with quoting. TODO: of course,
584584
-- quote_literal_cstr exists.
585-
-- prfx is prefix added before opt name, e.g. 'ADD ' for use in ALTER SERVER.
586585
-- Returns two strings: one with opts ready to pass to CREATE FOREIGN SERVER
587586
-- stmt, and one wih opts ready to pass to CREATE USER MAPPING.
588-
CREATE FUNCTION conninfo_to_postgres_fdw_opts(
589-
IN connstring text, IN prfx text DEFAULT '',
587+
CREATE FUNCTION conninfo_to_postgres_fdw_opts(IN connstring text,
590588
OUT server_opts text, OUT um_opts text) RETURNS record AS $$
591589
DECLARE
592590
connstring_keywords text[];
@@ -608,14 +606,14 @@ BEGIN
608606
um_opts := um_opts || ', ';
609607
END IF;
610608
um_opts_first_time_through := false;
611-
um_opts := prfx || um_opts ||
609+
um_opts := um_opts ||
612610
format('%s %L', connstring_keywords[i], connstring_vals[i]);
613611
ELSE -- server option
614612
IF NOT server_opts_first_time_through THEN
615613
server_opts := server_opts || ', ';
616614
END IF;
617615
server_opts_first_time_through := false;
618-
server_opts := prfx || server_opts ||
616+
server_opts := server_opts ||
619617
format('%s %L', connstring_keywords[i], connstring_vals[i]);
620618
END IF;
621619
END LOOP;

0 commit comments

Comments
 (0)