mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
Add some assertions to view reloption macros
In these macros, the rd_options pointer is cast to ViewOption *. Add some assertions that the passed-in relation is actually a view before doing that. Author: Nikolay Shaplov <dhyan@nataraj.su> Discussion: https://www.postgresql.org/message-id/flat/3634983.eHpMQ1mJnI@x200m
This commit is contained in:
parent
604bd36711
commit
3967737624
@ -351,9 +351,10 @@ typedef struct ViewOptions
|
||||
* Returns whether the relation is security view, or not. Note multiple
|
||||
* eval of argument!
|
||||
*/
|
||||
#define RelationIsSecurityView(relation) \
|
||||
((relation)->rd_options ? \
|
||||
((ViewOptions *) (relation)->rd_options)->security_barrier : false)
|
||||
#define RelationIsSecurityView(relation) \
|
||||
(AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
|
||||
(relation)->rd_options ? \
|
||||
((ViewOptions *) (relation)->rd_options)->security_barrier : false)
|
||||
|
||||
/*
|
||||
* RelationHasCheckOption
|
||||
@ -361,7 +362,8 @@ typedef struct ViewOptions
|
||||
* or the cascaded check option. Note multiple eval of argument!
|
||||
*/
|
||||
#define RelationHasCheckOption(relation) \
|
||||
((relation)->rd_options && \
|
||||
(AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
|
||||
(relation)->rd_options && \
|
||||
((ViewOptions *) (relation)->rd_options)->check_option != \
|
||||
VIEW_OPTION_CHECK_OPTION_NOT_SET)
|
||||
|
||||
@ -371,7 +373,8 @@ typedef struct ViewOptions
|
||||
* option. Note multiple eval of argument!
|
||||
*/
|
||||
#define RelationHasLocalCheckOption(relation) \
|
||||
((relation)->rd_options && \
|
||||
(AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
|
||||
(relation)->rd_options && \
|
||||
((ViewOptions *) (relation)->rd_options)->check_option == \
|
||||
VIEW_OPTION_CHECK_OPTION_LOCAL)
|
||||
|
||||
@ -381,7 +384,8 @@ typedef struct ViewOptions
|
||||
* option. Note multiple eval of argument!
|
||||
*/
|
||||
#define RelationHasCascadedCheckOption(relation) \
|
||||
((relation)->rd_options && \
|
||||
(AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
|
||||
(relation)->rd_options && \
|
||||
((ViewOptions *) (relation)->rd_options)->check_option == \
|
||||
VIEW_OPTION_CHECK_OPTION_CASCADED)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user