mirror of https://github.com/citusdata/citus.git
Append IF NOT EXISTS to deparsed CREATE SERVER commands (#3875)
Append IF NOT EXISTS to CREATE SERVER commands generated by pg_get_serverdef_string function when deparsing an existing server object that a foreign table depends.pull/3874/head
parent
741e808049
commit
8b39d12846
|
@ -173,7 +173,8 @@ pg_get_serverdef_string(Oid tableRelationId)
|
||||||
StringInfoData buffer = { NULL, 0, 0, 0 };
|
StringInfoData buffer = { NULL, 0, 0, 0 };
|
||||||
initStringInfo(&buffer);
|
initStringInfo(&buffer);
|
||||||
|
|
||||||
appendStringInfo(&buffer, "CREATE SERVER %s", quote_identifier(server->servername));
|
appendStringInfo(&buffer, "CREATE SERVER IF NOT EXISTS %s",
|
||||||
|
quote_identifier(server->servername));
|
||||||
if (server->servertype != NULL)
|
if (server->servertype != NULL)
|
||||||
{
|
{
|
||||||
appendStringInfo(&buffer, " TYPE %s",
|
appendStringInfo(&buffer, " TYPE %s",
|
||||||
|
|
|
@ -163,7 +163,7 @@ SELECT master_get_table_ddl_events('renamed_foreign_table');
|
||||||
NOTICE: foreign-data wrapper "fake_fdw" does not have an extension defined
|
NOTICE: foreign-data wrapper "fake_fdw" does not have an extension defined
|
||||||
master_get_table_ddl_events
|
master_get_table_ddl_events
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
CREATE SERVER fake_fdw_server FOREIGN DATA WRAPPER fake_fdw
|
CREATE SERVER IF NOT EXISTS fake_fdw_server FOREIGN DATA WRAPPER fake_fdw
|
||||||
CREATE FOREIGN TABLE public.renamed_foreign_table (id bigint NOT NULL, rename_name character(8) DEFAULT ''::text NOT NULL) SERVER fake_fdw_server OPTIONS (encoding 'utf-8', compression 'true')
|
CREATE FOREIGN TABLE public.renamed_foreign_table (id bigint NOT NULL, rename_name character(8) DEFAULT ''::text NOT NULL) SERVER fake_fdw_server OPTIONS (encoding 'utf-8', compression 'true')
|
||||||
ALTER TABLE public.renamed_foreign_table OWNER TO postgres
|
ALTER TABLE public.renamed_foreign_table OWNER TO postgres
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
Loading…
Reference in New Issue