Merge branch '2.3' into 2.4
This commit is contained in:
@ -87,6 +87,9 @@ void run(TestConnections& test)
|
|||||||
// This should NOT go through as a function is used with a masked column (that happens to be uppercase).
|
// This should NOT go through as a function is used with a masked column (that happens to be uppercase).
|
||||||
test_one(test, "SELECT LENGTH(A), b FROM masking_auto_firewall", Expect::FAILURE);
|
test_one(test, "SELECT LENGTH(A), b FROM masking_auto_firewall", Expect::FAILURE);
|
||||||
|
|
||||||
|
// This should NOT go through as a function is used with a masked column.
|
||||||
|
test_one(test, "SELECT CAST(A as CHAR), b FROM masking_auto_firewall", Expect::FAILURE);
|
||||||
|
|
||||||
// This SHOULD go through as a function is NOT used with a masked column
|
// This SHOULD go through as a function is NOT used with a masked column
|
||||||
// in a prepared statement.
|
// in a prepared statement.
|
||||||
test_one(test, "PREPARE ps1 FROM 'SELECT a, LENGTH(b) FROM masking_auto_firewall'", Expect::SUCCESS);
|
test_one(test, "PREPARE ps1 FROM 'SELECT a, LENGTH(b) FROM masking_auto_firewall'", Expect::SUCCESS);
|
||||||
@ -118,6 +121,9 @@ void run(TestConnections& test)
|
|||||||
// This should NOT succeed as a masked column is used in the statment.
|
// This should NOT succeed as a masked column is used in the statment.
|
||||||
test_one(test, "select 1 UNION select a FROM masking_auto_firewall", Expect::FAILURE);
|
test_one(test, "select 1 UNION select a FROM masking_auto_firewall", Expect::FAILURE);
|
||||||
|
|
||||||
|
// This should NOT succeed as a masked column is used in the statment.
|
||||||
|
test_one(test, "select 1 UNION ALL select a FROM masking_auto_firewall", Expect::FAILURE);
|
||||||
|
|
||||||
// This should NOT succeed as '*' is used in the statment.
|
// This should NOT succeed as '*' is used in the statment.
|
||||||
test_one(test, "select 1 UNION select * FROM masking_auto_firewall", Expect::FAILURE);
|
test_one(test, "select 1 UNION select * FROM masking_auto_firewall", Expect::FAILURE);
|
||||||
|
|
||||||
|
|||||||
@ -928,6 +928,7 @@ public:
|
|||||||
case TK_BITAND:
|
case TK_BITAND:
|
||||||
case TK_BITOR:
|
case TK_BITOR:
|
||||||
case TK_CASE:
|
case TK_CASE:
|
||||||
|
case TK_CAST:
|
||||||
case TK_IN:
|
case TK_IN:
|
||||||
case TK_ISNULL:
|
case TK_ISNULL:
|
||||||
case TK_MINUS:
|
case TK_MINUS:
|
||||||
@ -1258,6 +1259,11 @@ public:
|
|||||||
IGNORE_COMPOUND_SELECTS
|
IGNORE_COMPOUND_SELECTS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool is_significant_union(const Select* pSelect)
|
||||||
|
{
|
||||||
|
return ((pSelect->op == TK_UNION) || (pSelect->op == TK_ALL)) && pSelect->pPrior;
|
||||||
|
}
|
||||||
|
|
||||||
void update_field_infos_from_select(QcAliases& aliases,
|
void update_field_infos_from_select(QcAliases& aliases,
|
||||||
uint32_t context,
|
uint32_t context,
|
||||||
const Select* pSelect,
|
const Select* pSelect,
|
||||||
@ -1357,7 +1363,7 @@ public:
|
|||||||
|
|
||||||
if (compound_approach == ANALYZE_COMPOUND_SELECTS)
|
if (compound_approach == ANALYZE_COMPOUND_SELECTS)
|
||||||
{
|
{
|
||||||
if (((pSelect->op == TK_UNION) || (pSelect->op == TK_ALL)) && pSelect->pPrior)
|
if (is_significant_union(pSelect))
|
||||||
{
|
{
|
||||||
const Select* pPrior = pSelect->pPrior;
|
const Select* pPrior = pSelect->pPrior;
|
||||||
|
|
||||||
@ -2139,7 +2145,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
QcAliases aliases;
|
QcAliases aliases;
|
||||||
uint32_t context = (pSelect->op == TK_UNION && pSelect->pPrior) ? QC_FIELD_UNION : 0;
|
uint32_t context = is_significant_union(pSelect) ? QC_FIELD_UNION : 0;
|
||||||
update_field_infos_from_select(aliases, context, pSelect, NULL);
|
update_field_infos_from_select(aliases, context, pSelect, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4002,6 +4008,9 @@ static const char* get_token_symbol(int token)
|
|||||||
case TK_CASE:
|
case TK_CASE:
|
||||||
return "case";
|
return "case";
|
||||||
|
|
||||||
|
case TK_CAST:
|
||||||
|
return "cast";
|
||||||
|
|
||||||
case TK_IN:
|
case TK_IN:
|
||||||
return "in";
|
return "in";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user