Content-Length: 293860 | pFad | https://github.com/postgrespro/postgres/commit/98ec35b0bbf6003e89fc06aa140e12fd90bbad47

41 Fix corruption of pg_shdepend when copying deps from template database · postgrespro/postgres@98ec35b · GitHub
Skip to content

Commit 98ec35b

Browse files
committed
Fix corruption of pg_shdepend when copying deps from template database
Using for a new database a template database with shared dependencies that need to be copied over was causing a corruption of pg_shdepend because of an off-by-one computation error of the index number used for the values inserted with a slot. Issue introduced by e3931d0. Monitoring the rest of the code, there are no similar mistakes. Reported-by: Sven Klemm Author: Aleksander Alekseev Reviewed-by: Daniel Gustafsson, Michael Paquier Discussion: https://postgr.es/m/CAJ7c6TP0AowkUgNL6zcAK-s5HYsVHVBRWfu69FRubPpfwZGM9A@mail.gmail.com Backpatch-through: 14
1 parent f45dc59 commit 98ec35b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/backend/catalog/pg_shdepend.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -905,13 +905,13 @@ copyTemplateDependencies(Oid templateDbId, Oid newDbId)
905905

906906
shdep = (Form_pg_shdepend) GETSTRUCT(tup);
907907

908-
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_dbid] = ObjectIdGetDatum(newDbId);
909-
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_classid] = shdep->classid;
910-
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_objid] = shdep->objid;
911-
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_objsubid] = shdep->objsubid;
912-
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_refclassid] = shdep->refclassid;
913-
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_refobjid] = shdep->refobjid;
914-
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_deptype] = shdep->deptype;
908+
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_dbid - 1] = ObjectIdGetDatum(newDbId);
909+
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_classid - 1] = shdep->classid;
910+
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_objid - 1] = shdep->objid;
911+
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_objsubid - 1] = shdep->objsubid;
912+
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_refclassid - 1] = shdep->refclassid;
913+
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_refobjid - 1] = shdep->refobjid;
914+
slot[slot_stored_count]->tts_values[Anum_pg_shdepend_deptype - 1] = shdep->deptype;
915915

916916
ExecStoreVirtualTuple(slot[slot_stored_count]);
917917
slot_stored_count++;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/postgrespro/postgres/commit/98ec35b0bbf6003e89fc06aa140e12fd90bbad47

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy