summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/toast_helper.h8
-rw-r--r--src/include/access/tupmacs.h10
-rw-r--r--src/include/catalog/pg_attribute.h9
-rw-r--r--src/include/catalog/pg_type.h15
-rw-r--r--src/include/utils/lsyscache.h2
5 files changed, 27 insertions, 17 deletions
diff --git a/src/include/access/toast_helper.h b/src/include/access/toast_helper.h
index e59138df3e1..0e92acc546e 100644
--- a/src/include/access/toast_helper.h
+++ b/src/include/access/toast_helper.h
@@ -20,12 +20,12 @@
* Information about one column of a tuple being toasted.
*
* NOTE: toast_action[i] can have these values:
- * ' ' default handling
- * 'p' already processed --- don't touch it
- * 'x' incompressible, but OK to move off
+ * ' ' default handling
+ * TYPSTORAGE_PLAIN already processed --- don't touch it
+ * TYPSTORAGE_EXTENDED incompressible, but OK to move off
*
* NOTE: toast_attr[i].tai_size is only made valid for varlena attributes with
- * toast_action[i] different from 'p'.
+ * toast_action[i] different from TYPSTORAGE_PLAIN.
*/
typedef struct
{
diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h
index 0b205a0dc60..70157cf90ab 100644
--- a/src/include/access/tupmacs.h
+++ b/src/include/access/tupmacs.h
@@ -14,6 +14,8 @@
#ifndef TUPMACS_H
#define TUPMACS_H
+#include "catalog/pg_type_d.h" /* for TYPALIGN macros */
+
/*
* Check a tuple's null bitmap to determine whether the attribute is null.
@@ -145,11 +147,11 @@
*/
#define att_align_nominal(cur_offset, attalign) \
( \
- ((attalign) == 'i') ? INTALIGN(cur_offset) : \
- (((attalign) == 'c') ? (uintptr_t) (cur_offset) : \
- (((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \
+ ((attalign) == TYPALIGN_INT) ? INTALIGN(cur_offset) : \
+ (((attalign) == TYPALIGN_CHAR) ? (uintptr_t) (cur_offset) : \
+ (((attalign) == TYPALIGN_DOUBLE) ? DOUBLEALIGN(cur_offset) : \
( \
- AssertMacro((attalign) == 's'), \
+ AssertMacro((attalign) == TYPALIGN_SHORT), \
SHORTALIGN(cur_offset) \
))) \
)
diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h
index 591e0d65aed..a4cc80adad9 100644
--- a/src/include/catalog/pg_attribute.h
+++ b/src/include/catalog/pg_attribute.h
@@ -110,14 +110,7 @@ CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75,
/*----------
* attstorage tells for VARLENA attributes, what the heap access
* methods can do to it if a given tuple doesn't fit into a page.
- * Possible values are
- * 'p': Value must be stored plain always
- * 'e': Value can be stored in "secondary" relation (if relation
- * has one, see pg_class.reltoastrelid)
- * 'm': Value can be stored compressed inline
- * 'x': Value can be stored compressed inline or in "secondary"
- * Note that 'm' fields can also be moved out to secondary storage,
- * but only as a last resort ('e' and 'x' fields are moved first).
+ * Possible values are as for pg_type.typstorage (see TYPSTORAGE macros).
*----------
*/
char attstorage;
diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h
index e1a5ab3df30..f972f941e05 100644
--- a/src/include/catalog/pg_type.h
+++ b/src/include/catalog/pg_type.h
@@ -155,6 +155,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati
* 's' = SHORT alignment (2 bytes on most machines).
* 'i' = INT alignment (4 bytes on most machines).
* 'd' = DOUBLE alignment (8 bytes on many machines, but by no means all).
+ * (Use the TYPALIGN macros below for these.)
*
* See include/access/tupmacs.h for the macros that compute these
* alignment requirements. Note also that we allow the nominal alignment
@@ -176,6 +177,10 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati
* 'e' EXTERNAL external storage possible, don't try to compress
* 'x' EXTENDED try to compress and store external if required
* 'm' MAIN like 'x' but try to keep in main tuple
+ * (Use the TYPSTORAGE macros below for these.)
+ *
+ * Note that 'm' fields can also be moved out to secondary storage,
+ * but only as a last resort ('e' and 'x' fields are moved first).
* ----------------
*/
char typstorage BKI_DEFAULT(p) BKI_ARRAY_DEFAULT(x);
@@ -278,6 +283,16 @@ typedef FormData_pg_type *Form_pg_type;
#define TYPCATEGORY_BITSTRING 'V' /* er ... "varbit"? */
#define TYPCATEGORY_UNKNOWN 'X'
+#define TYPALIGN_CHAR 'c' /* char alignment (i.e. unaligned) */
+#define TYPALIGN_SHORT 's' /* short alignment (typically 2 bytes) */
+#define TYPALIGN_INT 'i' /* int alignment (typically 4 bytes) */
+#define TYPALIGN_DOUBLE 'd' /* double alignment (often 8 bytes) */
+
+#define TYPSTORAGE_PLAIN 'p' /* type not prepared for toasting */
+#define TYPSTORAGE_EXTERNAL 'e' /* toastable, don't try to compress */
+#define TYPSTORAGE_EXTENDED 'x' /* fully toastable */
+#define TYPSTORAGE_MAIN 'm' /* like 'x' but try to store inline */
+
/* Is a type OID a polymorphic pseudotype? (Beware of multiple evaluation) */
#define IsPolymorphicType(typid) \
((typid) == ANYELEMENTOID || \
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 370f62a1334..f132d394581 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -186,6 +186,6 @@ extern Oid get_index_column_opclass(Oid index_oid, int attno);
/* type_is_array_domain accepts both plain arrays and domains over arrays */
#define type_is_array_domain(typid) (get_base_element_type(typid) != InvalidOid)
-#define TypeIsToastable(typid) (get_typstorage(typid) != 'p')
+#define TypeIsToastable(typid) (get_typstorage(typid) != TYPSTORAGE_PLAIN)
#endif /* LSYSCACHE_H */