mirror of https://github.com/citusdata/citus.git
Quote all identifiers that we use for logical replication (#6604)
In #6598 it was noticed that Citus could generate syntactically invalid statements during logical replication. With #6603 we resolved the direct issue, by only generating valid subscription names. But there was also the underlying problem that we did not escape certain identifier strings. While in theory this should be okay since we should only generate names that are valid, this issue reiterated that we should not take this for granted. As an extra line of defense this quotes all identifiers we use during logical replication setup.pull/6605/head
parent
44e09128f0
commit
c2b4087ff0
|
@ -1315,7 +1315,7 @@ CreatePublications(MultiConnection *connection,
|
|||
bool prefixWithComma = false;
|
||||
|
||||
appendStringInfo(createPublicationCommand, "CREATE PUBLICATION %s FOR TABLE ",
|
||||
entry->name);
|
||||
quote_identifier(entry->name));
|
||||
|
||||
ShardInterval *shard = NULL;
|
||||
foreach_ptr(shard, entry->shardIntervals)
|
||||
|
@ -1498,8 +1498,8 @@ CreateSubscriptions(MultiConnection *sourceConnection,
|
|||
"SET LOCAL citus.enable_ddl_propagation TO OFF;",
|
||||
psprintf(
|
||||
"CREATE USER %s SUPERUSER IN ROLE %s;",
|
||||
target->subscriptionOwnerName,
|
||||
GetUserNameFromId(ownerId, false)
|
||||
quote_identifier(target->subscriptionOwnerName),
|
||||
quote_identifier(GetUserNameFromId(ownerId, false))
|
||||
)));
|
||||
|
||||
InsertCleanupRecordInSubtransaction(CLEANUP_OBJECT_USER,
|
||||
|
@ -1554,8 +1554,8 @@ CreateSubscriptions(MultiConnection *sourceConnection,
|
|||
|
||||
ExecuteCriticalRemoteCommand(target->superuserConnection, psprintf(
|
||||
"ALTER SUBSCRIPTION %s OWNER TO %s",
|
||||
target->subscriptionName,
|
||||
target->subscriptionOwnerName
|
||||
quote_identifier(target->subscriptionName),
|
||||
quote_identifier(target->subscriptionOwnerName)
|
||||
));
|
||||
|
||||
/*
|
||||
|
@ -1568,7 +1568,7 @@ CreateSubscriptions(MultiConnection *sourceConnection,
|
|||
"SET LOCAL citus.enable_ddl_propagation TO OFF;",
|
||||
psprintf(
|
||||
"ALTER ROLE %s NOSUPERUSER;",
|
||||
target->subscriptionOwnerName
|
||||
quote_identifier(target->subscriptionOwnerName)
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue