This causes an assertion failure when executed in a hot standby server:
select * from pg_check_visible('pg_database');
TRAP: failed Assert("!RecoveryInProgress()"), File:
"../src/backend/storage/ipc/procarray.c", Line: 2710, PID: 1142572
GetStrictOldestNonRemovableTransactionId does this:
> if (rel == NULL || rel->rd_rel->relisshared || RecoveryInProgress())
> {
> /* Shared relation: take into account all running xids */
> runningTransactions = GetRunningTransactionData();
> LWLockRelease(ProcArrayLock);
> LWLockRelease(XidGenLock);
> return runningTransactions->oldestRunningXid;
> }
And GetRunningTransactionData() has this:
> Assert(!RecoveryInProgress());
So it's easy to see that you will hit that assertion.
--
Heikki Linnakangas
Neon (https://neon.tech)