diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/catalog.h | 2 | ||||
-rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
-rw-r--r-- | src/include/catalog/heap.h | 2 | ||||
-rw-r--r-- | src/include/catalog/pg_class.h | 15 | ||||
-rw-r--r-- | src/include/catalog/storage.h | 2 | ||||
-rw-r--r-- | src/include/commands/tablespace.h | 2 | ||||
-rw-r--r-- | src/include/nodes/primnodes.h | 2 | ||||
-rw-r--r-- | src/include/utils/rel.h | 25 | ||||
-rw-r--r-- | src/include/utils/relcache.h | 3 |
9 files changed, 41 insertions, 14 deletions
diff --git a/src/include/catalog/catalog.h b/src/include/catalog/catalog.h index 97c808bc509..56dcdd53fe2 100644 --- a/src/include/catalog/catalog.h +++ b/src/include/catalog/catalog.h @@ -56,6 +56,6 @@ extern Oid GetNewOid(Relation relation); extern Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn); extern Oid GetNewRelFileNode(Oid reltablespace, Relation pg_class, - BackendId backend); + char relpersistence); #endif /* CATALOG_H */ diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 6c12f7cbf82..1c3d14951c0 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201012031 +#define CATALOG_VERSION_NO 201012131 #endif diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h index 7795bda323b..646ab9c8f19 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -40,6 +40,7 @@ extern Relation heap_create(const char *relname, Oid relid, TupleDesc tupDesc, char relkind, + char relpersistence, bool shared_relation, bool mapped_relation, bool allow_system_table_mods); @@ -54,6 +55,7 @@ extern Oid heap_create_with_catalog(const char *relname, TupleDesc tupdesc, List *cooked_constraints, char relkind, + char relpersistence, bool shared_relation, bool mapped_relation, bool oidislocal, diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index f50cf9d55bb..1edbfe378b1 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -49,7 +49,7 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO Oid reltoastidxid; /* if toast table, OID of chunk_id index */ bool relhasindex; /* T if has (or has had) any indexes */ bool relisshared; /* T if shared across databases */ - bool relistemp; /* T if temporary relation */ + char relpersistence; /* see RELPERSISTENCE_xxx constants */ char relkind; /* see RELKIND_xxx constants below */ int2 relnatts; /* number of user attributes */ @@ -108,7 +108,7 @@ typedef FormData_pg_class *Form_pg_class; #define Anum_pg_class_reltoastidxid 12 #define Anum_pg_class_relhasindex 13 #define Anum_pg_class_relisshared 14 -#define Anum_pg_class_relistemp 15 +#define Anum_pg_class_relpersistence 15 #define Anum_pg_class_relkind 16 #define Anum_pg_class_relnatts 17 #define Anum_pg_class_relchecks 18 @@ -132,13 +132,13 @@ typedef FormData_pg_class *Form_pg_class; */ /* Note: "3" in the relfrozenxid column stands for FirstNormalTransactionId */ -DATA(insert OID = 1247 ( pg_type PGNSP 71 0 PGUID 0 0 0 0 0 0 0 f f f r 28 0 t f f f f f 3 _null_ _null_ )); +DATA(insert OID = 1247 ( pg_type PGNSP 71 0 PGUID 0 0 0 0 0 0 0 f f p r 28 0 t f f f f f 3 _null_ _null_ )); DESCR(""); -DATA(insert OID = 1249 ( pg_attribute PGNSP 75 0 PGUID 0 0 0 0 0 0 0 f f f r 19 0 f f f f f f 3 _null_ _null_ )); +DATA(insert OID = 1249 ( pg_attribute PGNSP 75 0 PGUID 0 0 0 0 0 0 0 f f p r 19 0 f f f f f f 3 _null_ _null_ )); DESCR(""); -DATA(insert OID = 1255 ( pg_proc PGNSP 81 0 PGUID 0 0 0 0 0 0 0 f f f r 25 0 t f f f f f 3 _null_ _null_ )); +DATA(insert OID = 1255 ( pg_proc PGNSP 81 0 PGUID 0 0 0 0 0 0 0 f f p r 25 0 t f f f f f 3 _null_ _null_ )); DESCR(""); -DATA(insert OID = 1259 ( pg_class PGNSP 83 0 PGUID 0 0 0 0 0 0 0 f f f r 27 0 t f f f f f 3 _null_ _null_ )); +DATA(insert OID = 1259 ( pg_class PGNSP 83 0 PGUID 0 0 0 0 0 0 0 f f p r 27 0 t f f f f f 3 _null_ _null_ )); DESCR(""); #define RELKIND_INDEX 'i' /* secondary index */ @@ -149,4 +149,7 @@ DESCR(""); #define RELKIND_VIEW 'v' /* view */ #define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ +#define RELPERSISTENCE_PERMANENT 'p' +#define RELPERSISTENCE_TEMP 't' + #endif /* PG_CLASS_H */ diff --git a/src/include/catalog/storage.h b/src/include/catalog/storage.h index d7b8731838c..f086b1c33f6 100644 --- a/src/include/catalog/storage.h +++ b/src/include/catalog/storage.h @@ -20,7 +20,7 @@ #include "storage/relfilenode.h" #include "utils/relcache.h" -extern void RelationCreateStorage(RelFileNode rnode, bool istemp); +extern void RelationCreateStorage(RelFileNode rnode, char relpersistence); extern void RelationDropStorage(Relation rel); extern void RelationPreserveStorage(RelFileNode rnode); extern void RelationTruncate(Relation rel, BlockNumber nblocks); diff --git a/src/include/commands/tablespace.h b/src/include/commands/tablespace.h index 327fbc6c4f9..1e3f6ca0c62 100644 --- a/src/include/commands/tablespace.h +++ b/src/include/commands/tablespace.h @@ -47,7 +47,7 @@ extern void AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt); extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo); -extern Oid GetDefaultTablespace(bool forTemp); +extern Oid GetDefaultTablespace(char relpersistence); extern void PrepareTempTablespaces(void); diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index b17adf2aa3f..ba5ae371c01 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -74,7 +74,7 @@ typedef struct RangeVar char *relname; /* the relation/sequence name */ InhOption inhOpt; /* expand rel by inheritance? recursively act * on children? */ - bool istemp; /* is this a temp relation/sequence? */ + char relpersistence; /* see RELPERSISTENCE_* in pg_class.h */ Alias *alias; /* table alias & optional column aliases */ int location; /* token location, or -1 if unknown */ } RangeVar; diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 39e0365c0b1..88a3168d133 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -132,7 +132,6 @@ typedef struct RelationData struct SMgrRelationData *rd_smgr; /* cached file handle, or NULL */ int rd_refcnt; /* reference count */ BackendId rd_backend; /* owning backend id, if temporary relation */ - bool rd_istemp; /* rel is a temporary relation */ bool rd_isnailed; /* rel is nailed in cache */ bool rd_isvalid; /* relcache entry is valid */ char rd_indexvalid; /* state of rd_indexlist: 0 = not valid, 1 = @@ -390,6 +389,27 @@ typedef struct StdRdOptions } while (0) /* + * RelationNeedsWAL + * True if relation needs WAL. + */ +#define RelationNeedsWAL(relation) \ + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT) + +/* + * RelationUsesLocalBuffers + * True if relation's pages are stored in local buffers. + */ +#define RelationUsesLocalBuffers(relation) \ + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP) + +/* + * RelationUsesTempNamespace + * True if relation's catalog entries live in a private namespace. + */ +#define RelationUsesTempNamespace(relation) \ + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP) + +/* * RELATION_IS_LOCAL * If a rel is either temp or newly created in the current transaction, * it can be assumed to be visible only to the current backend. @@ -407,7 +427,8 @@ typedef struct StdRdOptions * Beware of multiple eval of argument */ #define RELATION_IS_OTHER_TEMP(relation) \ - ((relation)->rd_istemp && (relation)->rd_backend != MyBackendId) + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP \ + && (relation)->rd_backend != MyBackendId) /* routines in utils/cache/relcache.c */ extern void RelationIncrementReferenceCount(Relation rel); diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h index 10d82d4b412..35000500c11 100644 --- a/src/include/utils/relcache.h +++ b/src/include/utils/relcache.h @@ -69,7 +69,8 @@ extern Relation RelationBuildLocalRelation(const char *relname, Oid relid, Oid reltablespace, bool shared_relation, - bool mapped_relation); + bool mapped_relation, + char relpersistence); /* * Routine to manage assignment of new relfilenode to a relation |