mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
Move materialized views' is-populated status into their pg_class entries.
Previously this state was represented by whether the view's disk file had zero or nonzero size, which is problematic for numerous reasons, since it's breaking a fundamental assumption about heap storage. This was done to allow unlogged matviews to revert to unpopulated status after a crash despite our lack of any ability to update catalog entries post-crash. However, this poses enough risk of future problems that it seems better to not support unlogged matviews until we can find another way. Accordingly, revert that choice as well as a number of existing kluges forced by it in favor of creating a pg_class.relispopulated flag column.
This commit is contained in:
@ -834,30 +834,3 @@ pg_relation_filepath(PG_FUNCTION_ARGS)
|
||||
|
||||
PG_RETURN_TEXT_P(cstring_to_text(path));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Indicate whether a relation is scannable.
|
||||
*
|
||||
* Currently, this is always true except for a materialized view which has not
|
||||
* been populated. It is expected that other conditions for allowing a
|
||||
* materialized view to be scanned will be added in later releases.
|
||||
*/
|
||||
Datum
|
||||
pg_relation_is_scannable(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid relid;
|
||||
Relation relation;
|
||||
bool result;
|
||||
|
||||
relid = PG_GETARG_OID(0);
|
||||
relation = try_relation_open(relid, AccessShareLock);
|
||||
|
||||
if (relation == NULL)
|
||||
PG_RETURN_BOOL(false);
|
||||
|
||||
result = RelationIsScannable(relation);
|
||||
|
||||
relation_close(relation, AccessShareLock);
|
||||
PG_RETURN_BOOL(result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user