Avoid unnecessary allocation for tablesync.c COPY buffer

copybuf serves only as a read-only parse buffer and is never
appended-to, enlarged or reset.  Previously it was a file-level static
StringInfoData, allocated via makeStringInfo(), but that was abusing the
StringInfo interface.

A function-level static read-only StringInfo, as introduced by commit
f0efa5aec193, works just as well, and is less notionally bogus.

There are no functional changes here: unconsumed leftover bytes are
still consumed in the next call to this function, just like in the
previous coding.

Author: Chao Li <[email protected]>
Reviewed-by: Denis Smirnov <[email protected]>
Reviewed-by: ZizhuanLiu (X-MAN) <[email protected]>
Commitfest: https://commitfest.postgresql.org/patch/6757/
Discussion: https://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7720f61b7d6f5b1f702ecc1d46dd87d25808a785

Modified Files
--------------
src/backend/replication/logical/tablesync.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

Reply via email to