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

From: Xiaoran Wang <wxiaoran(at)vmware(dot)com>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: About `GetNonHistoricCatalogSnapshot`: does it allow developers to use catalog snapshot to scan non-catalog tables?
Date: 2023-07-13 08:55:18
Message-ID: DS0PR05MB96894638B505FCC646AD9DD0BA37A@DS0PR05MB9689.namprd05.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-07-13 09:16:22 Re: [Patch] Use *other* indexes on the subscriber when REPLICA IDENTITY is FULL
Previous Message Masahiko Sawada 2023-07-13 08:50:23 Re: Consistent coding for the naming of LR workers