About `GetNonHistoricCatalogSnapshot`: does it allow developers to use catalog snapshot to scan non-catalog tables? - Mailing list pgsql-hackers

From Xiaoran Wang
Subject About `GetNonHistoricCatalogSnapshot`: does it allow developers to use catalog snapshot to scan non-catalog tables?
Date
Msg-id DS0PR05MB96894638B505FCC646AD9DD0BA37A@DS0PR05MB9689.namprd05.prod.outlook.com
Whole thread Raw
List pgsql-hackers
Hi,
I have a question about the routine "GetNonHistoricCatalogSnapshot".
It has a param "Oid relid​​". It firstly
checks if the relation has systemcache or ​if it is in "RelationInvalidatesSnapshotsOnly" related relations.
If yes, it will invalidate the CatalogSnapshot.

I just wonder in which situation the developer tries to scan a non-catalog table by CatalogSnapshot. 

By the way, in the routine " SnapshotSetCommandId", there is a comment 

 /* Should we do the same with CatalogSnapshot? */

From my point of view, there is no need to update the curcid of CatalogSnapshot,  as the CatalogSnapshot
will be invalidated if there are any updates on the catalog tables in the current transaction.

If I misunderstood, please correct me!

Best regards, xiaoran

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Consistent coding for the naming of LR workers
Next
From: Amit Kapila
Date:
Subject: Re: [Patch] Use *other* indexes on the subscriber when REPLICA IDENTITY is FULL