Merge pull request #47387 from sippy/pg_select_from_only

Use "SELECT * FROM ONLY xyz", not "SELECT * FROM xyz" while replicating
This commit is contained in:
Alexey Milovidov 2023-03-30 22:57:57 +03:00 committed by GitHub
commit 614be6f718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -354,7 +354,7 @@ StorageInfo PostgreSQLReplicationHandler::loadFromSnapshot(postgres::Connection
/// Load from snapshot, which will show table state before creation of replication slot.
/// Already connected to needed database, no need to add it to query.
auto quoted_name = doubleQuoteWithSchema(table_name);
query_str = fmt::format("SELECT * FROM {}", quoted_name);
query_str = fmt::format("SELECT * FROM ONLY {}", quoted_name);
LOG_DEBUG(log, "Loading PostgreSQL table {}.{}", postgres_database, quoted_name);
auto table_structure = fetchTableStructure(*tx, table_name);