From 095d109ccd76ca4c46c4ea2be30d63d70361c5f9 Mon Sep 17 00:00:00 2001 From: John Naylor Date: Thu, 30 Nov 2023 15:25:57 +0700 Subject: Remove redundant setting of hashkey after insertion It's not necessary to fill the key field in most cases, since hash_search has already done that. Some existing call sites have an assert or comment that this contract has been fulfilled, but those are quite old and that practice seems unnecessary here. While at it, remove a nearby redundant assignment that a smart compiler will elide anyway. Zhao Junwang, with some adjustments by me Reviewed by Nathan Bossart, with additional feedback from Tom Lane Discussion: http://postgr.es/m/CAEG8a3%2BUPF%3DR2QGPgJMF2mKh8xPd1H2TmfH77zPuVUFdBpiGUA%40mail.gmail.com --- src/backend/commands/tablecmds.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/backend/commands/tablecmds.c') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 323d9bf8702..7206da7c53c 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -2104,10 +2104,7 @@ ExecuteTruncateGuts(List *explicit_rels, /* Find or create cached entry for the foreign table */ ft_info = hash_search(ft_htab, &serverid, HASH_ENTER, &found); if (!found) - { - ft_info->serverid = serverid; ft_info->rels = NIL; - } /* * Save the foreign table in the entry of the server that the -- cgit v1.2.3