diff options
Diffstat (limited to 'src/include/utils/rel.h')
-rw-r--r-- | src/include/utils/rel.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 58cc3f7ea1a..589c9a81b69 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -208,6 +208,7 @@ typedef struct StdRdOptions int fillfactor; /* page fill factor in percent (0..100) */ AutoVacOpts autovacuum; /* autovacuum-related options */ bool security_barrier; /* for views */ + int check_option_offset; /* for views */ } StdRdOptions; #define HEAP_MIN_FILLFACTOR 10 @@ -244,6 +245,39 @@ typedef struct StdRdOptions ((StdRdOptions *) (relation)->rd_options)->security_barrier : false) /* + * RelationHasCheckOption + * Returns true if the relation is a view defined with either the local + * or the cascaded check option. + */ +#define RelationHasCheckOption(relation) \ + ((relation)->rd_options && \ + ((StdRdOptions *) (relation)->rd_options)->check_option_offset != 0) + +/* + * RelationHasLocalCheckOption + * Returns true if the relation is a view defined with the local check + * option. + */ +#define RelationHasLocalCheckOption(relation) \ + ((relation)->rd_options && \ + ((StdRdOptions *) (relation)->rd_options)->check_option_offset != 0 ? \ + strcmp((char *) (relation)->rd_options + \ + ((StdRdOptions *) (relation)->rd_options)->check_option_offset, \ + "local") == 0 : false) + +/* + * RelationHasCascadedCheckOption + * Returns true if the relation is a view defined with the cascaded check + * option. + */ +#define RelationHasCascadedCheckOption(relation) \ + ((relation)->rd_options && \ + ((StdRdOptions *) (relation)->rd_options)->check_option_offset != 0 ? \ + strcmp((char *) (relation)->rd_options + \ + ((StdRdOptions *) (relation)->rd_options)->check_option_offset, \ + "cascaded") == 0 : false) + +/* * RelationIsValid * True iff relation descriptor is valid. */ |