Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CBRD-23679] Adding a configuration parameter and control for strict type #2460

Merged
merged 1 commit into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/parser/parse_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -2256,6 +2256,7 @@ struct pt_expr_info
#define PT_EXPR_INFO_GROUPBYNUM_LIMIT 32768 /* flag that marks if the expression resulted from a GROUP BY ... LIMIT
* statement */
#define PT_EXPR_INFO_DO_NOT_AUTOPARAM 65536 /* don't auto parameterize expr at qo_do_auto_parameterize() */
#define PT_EXPR_INFO_CAST_WRAP 131072 /* 0x20000, CAST is wrapped by compiling */
int flag; /* flags */
#define PT_EXPR_INFO_IS_FLAGED(e, f) ((e)->info.expr.flag & (int) (f))
#define PT_EXPR_INFO_SET_FLAG(e, f) (e)->info.expr.flag |= (int) (f)
Expand Down
1 change: 1 addition & 0 deletions src/parser/type_checking.c
Original file line number Diff line number Diff line change
Expand Up @@ -8446,6 +8446,7 @@ pt_wrap_with_cast_op (PARSER_CONTEXT * parser, PT_NODE * arg, PT_TYPE_ENUM new_t

new_att->type_enum = new_type;
new_att->info.expr.op = PT_CAST;
PT_EXPR_INFO_SET_FLAG (new_att, PT_EXPR_INFO_CAST_WRAP);
new_att->info.expr.cast_type = new_dt;
new_att->info.expr.arg1 = arg;
new_att->next = next_att;
Expand Down
9 changes: 8 additions & 1 deletion src/parser/xasl_generation.c
Original file line number Diff line number Diff line change
Expand Up @@ -8737,7 +8737,14 @@ pt_to_regu_variable (PARSER_CONTEXT * parser, PT_NODE * node, UNBOX unbox)
}
else
{
op = T_CAST;
if (PT_EXPR_INFO_IS_FLAGED (node, PT_EXPR_INFO_CAST_WRAP))
{
op = T_CAST_WRAP;
}
else
{
op = T_CAST;
}
}

if (PT_EXPR_INFO_IS_FLAGED (node, PT_EXPR_INFO_CAST_COLL_MODIFIER))
Expand Down
4 changes: 3 additions & 1 deletion src/query/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ fetch_peek_arith (THREAD_ENTRY * thread_p, REGU_VARIABLE * regu_var, val_descr *
case T_BIN:
case T_CAST:
case T_CAST_NOFAIL:
case T_CAST_WRAP:
case T_EXTRACT:
case T_FLOOR:
case T_CEIL:
Expand Down Expand Up @@ -2318,6 +2319,7 @@ fetch_peek_arith (THREAD_ENTRY * thread_p, REGU_VARIABLE * regu_var, val_descr *
break;

case T_CAST:
case T_CAST_WRAP:
if (REGU_VARIABLE_IS_FLAGED (regu_var, REGU_VARIABLE_APPLY_COLLATION))
{
pr_clone_value (peek_right, arithptr->value);
Expand Down Expand Up @@ -2347,7 +2349,7 @@ fetch_peek_arith (THREAD_ENTRY * thread_p, REGU_VARIABLE * regu_var, val_descr *
}
else
{
if (REGU_VARIABLE_IS_FLAGED (regu_var, REGU_VARIABLE_STRICT_TYPE_CAST))
if (REGU_VARIABLE_IS_FLAGED (regu_var, REGU_VARIABLE_STRICT_TYPE_CAST) && arithptr->opcode == T_CAST_WRAP)
{
dom_status = tp_value_cast (peek_right, arithptr->value, arithptr->domain, false);
}
Expand Down
1 change: 1 addition & 0 deletions src/storage/storage_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ typedef enum
T_NEXT_VALUE,
T_CAST,
T_CAST_NOFAIL,
T_CAST_WRAP,
T_CASE,
T_EXTRACT,
T_LOCAL_TRANSACTION_ID,
Expand Down