extern JsonFormat *makeJsonFormat(JsonFormatType type, JsonEncoding encoding,
int location);
-extern JsonValueExpr *makeJsonValueExpr(Expr *expr, JsonFormat *format);
+extern JsonValueExpr *makeJsonValueExpr(Expr *raw_expr, Expr *formatted_expr,
+ JsonFormat *format);
extern Node *makeJsonKeyValue(Node *key, Node *value);
extern Node *makeJsonIsPredicate(Node *expr, JsonFormat *format,
JsonValueType item_type, bool unique_keys,
#define ACL_CONNECT (1<<11) /* for databases */
#define ACL_SET (1<<12) /* for configuration parameters */
#define ACL_ALTER_SYSTEM (1<<13) /* for configuration parameters */
-#define ACL_MAINTAIN (1<<14) /* for relations */
-#define N_ACL_RIGHTS 15 /* 1 plus the last 1<<x */
+#define N_ACL_RIGHTS 14 /* 1 plus the last 1<<x */
#define ACL_NO_RIGHTS 0
/* Currently, SELECT ... FOR [KEY] UPDATE/SHARE requires UPDATE privileges */
#define ACL_SELECT_FOR_UPDATE ACL_UPDATE
* this RTE in the containing struct's list of same; 0 if permissions need
* not be checked for this RTE.
*
- * As a special case, relid, rellockmode, and perminfoindex can also be
- * set (nonzero) in an RTE_SUBQUERY RTE. This occurs when we convert an
- * RTE_RELATION RTE naming a view into an RTE_SUBQUERY containing the
- * view's query. We still need to perform run-time locking and permission
- * checks on the view, even though it's not directly used in the query
- * anymore, and the most expedient way to do that is to retain these
- * fields from the old state of the RTE.
+ * As a special case, relid, relkind, rellockmode, and perminfoindex can
+ * also be set (nonzero) in an RTE_SUBQUERY RTE. This occurs when we
+ * convert an RTE_RELATION RTE naming a view into an RTE_SUBQUERY
+ * containing the view's query. We still need to perform run-time locking
+ * and permission checks on the view, even though it's not directly used
+ * in the query anymore, and the most expedient way to do that is to
+ * retain these fields from the old state of the RTE.
*
* As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate
* that the tuple format of the tuplestore is the same as the referenced
* see build_coercion_expression().
* * Nested FieldStore/SubscriptingRef assignment expressions in INSERT/UPDATE;
* see transformAssignmentIndirection().
+ * * Placeholder for intermediate results in some SQL/JSON expression nodes,
+ * such as JsonConstructorExpr.
*
* The uses in CaseExpr and ArrayCoerceExpr are safe only to the extent that
* there is not any other CaseExpr or ArrayCoerceExpr between the value source
/*
* JsonValueExpr -
* representation of JSON value expression (expr [FORMAT JsonFormat])
+ *
+ * The actual value is obtained by evaluating formatted_expr. raw_expr is
+ * only there for displaying the original user-written expression and is not
+ * evaluated by ExecInterpExpr() and eval_const_exprs_mutator().
*/
typedef struct JsonValueExpr
{
NodeTag type;
Expr *raw_expr; /* raw expression */
- Expr *formatted_expr; /* formatted expression or NULL */
+ Expr *formatted_expr; /* formatted expression */
JsonFormat *format; /* FORMAT clause, if specified */
} JsonValueExpr;
%type <list> hash_partbound
%type <defelt> hash_partbound_elem
+%type <node> json_format_clause_opt
+ json_value_expr
+ json_output_clause_opt
+ json_name_and_value
+ json_aggregate_func
+%type <list> json_name_and_value_list
+ json_value_expr_list
+ json_array_aggregate_order_by_clause_opt
+%type <ival> json_encoding_clause_opt
+ json_predicate_type_constraint
+%type <boolean> json_key_uniqueness_constraint_opt
+ json_object_constructor_null_clause_opt
+ json_array_constructor_null_clause_opt
-%type <node> json_format_clause_opt
- json_value_expr
- json_output_clause_opt
- json_name_and_value
- json_aggregate_func
-
-%type <list> json_name_and_value_list
- json_value_expr_list
- json_array_aggregate_order_by_clause_opt
-
-%type <ival> json_encoding_clause_opt
- json_predicate_type_constraint
-
-%type <boolean> json_key_uniqueness_constraint_opt
- json_object_constructor_null_clause_opt
- json_array_constructor_null_clause_opt
/*
* Non-keyword token types. These are hard-wired into the "flex" lexer.
json_value_expr:
a_expr json_format_clause_opt
{
- $$ = (Node *) makeJsonValueExpr((Expr *) $1, castNode(JsonFormat, $2));
+ /* formatted_expr will be set during parse-analysis. */
+ $$ = (Node *) makeJsonValueExpr((Expr *) $1, NULL,
+ castNode(JsonFormat, $2));
}
;
%type <list> hash_partbound
%type <defelt> hash_partbound_elem
+%type <node> json_format_clause_opt
+ json_value_expr
+ json_output_clause_opt
+ json_name_and_value
+ json_aggregate_func
+%type <list> json_name_and_value_list
+ json_value_expr_list
+ json_array_aggregate_order_by_clause_opt
+%type <ival> json_encoding_clause_opt
+ json_predicate_type_constraint
+%type <boolean> json_key_uniqueness_constraint_opt
+ json_object_constructor_null_clause_opt
+ json_array_constructor_null_clause_opt
-%type <node> json_format_clause_opt
- json_value_expr
- json_output_clause_opt
- json_name_and_value
- json_aggregate_func
-
-%type <list> json_name_and_value_list
- json_value_expr_list
- json_array_aggregate_order_by_clause_opt
-
-%type <ival> json_encoding_clause_opt
- json_predicate_type_constraint
-
-%type <boolean> json_key_uniqueness_constraint_opt
- json_object_constructor_null_clause_opt
- json_array_constructor_null_clause_opt
/*
* Non-keyword token types. These are hard-wired into the "flex" lexer.
json_value_expr:
a_expr json_format_clause_opt
{
- $$ = (Node *) makeJsonValueExpr((Expr *) $1, castNode(JsonFormat, $2));
+ /* formatted_expr will be set during parse-analysis. */
+ $$ = (Node *) makeJsonValueExpr((Expr *) $1, NULL,
+ castNode(JsonFormat, $2));
}
;
%type <list> hash_partbound
%type <defelt> hash_partbound_elem
+%type <node> json_format_clause_opt
+ json_value_expr
+ json_output_clause_opt
+ json_name_and_value
+ json_aggregate_func
+%type <list> json_name_and_value_list
+ json_value_expr_list
+ json_array_aggregate_order_by_clause_opt
+%type <ival> json_encoding_clause_opt
+ json_predicate_type_constraint
+%type <boolean> json_key_uniqueness_constraint_opt
+ json_object_constructor_null_clause_opt
+ json_array_constructor_null_clause_opt
-%type <node> json_format_clause_opt
- json_value_expr
- json_output_clause_opt
- json_name_and_value
- json_aggregate_func
-
-%type <list> json_name_and_value_list
- json_value_expr_list
- json_array_aggregate_order_by_clause_opt
-
-%type <ival> json_encoding_clause_opt
- json_predicate_type_constraint
-
-%type <boolean> json_key_uniqueness_constraint_opt
- json_object_constructor_null_clause_opt
- json_array_constructor_null_clause_opt
/*
* Non-keyword token types. These are hard-wired into the "flex" lexer.
json_value_expr:
a_expr json_format_clause_opt
{
- $$ = (Node *) makeJsonValueExpr((Expr *) $1, castNode(JsonFormat, $2));
+ /* formatted_expr will be set during parse-analysis. */
+ $$ = (Node *) makeJsonValueExpr((Expr *) $1, NULL,
+ castNode(JsonFormat, $2));
}
;
* * creates a JsonValueExpr node
* */
JsonValueExpr *
-makeJsonValueExpr(Expr *expr, JsonFormat *format)
+makeJsonValueExpr(Expr *raw_expr, Expr *formatted_expr,
+ JsonFormat *format)
{
JsonValueExpr *jve = makeNode(JsonValueExpr);
- jve->raw_expr = expr;
- jve->formatted_expr = NULL;
+ jve->raw_expr = raw_expr;
+ jve->formatted_expr = formatted_expr;
jve->format = format;
return jve;