mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-28696 View created as "select b''; " references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
This commit is contained in:
@ -149,12 +149,9 @@ select N'', length(N'');
|
|||||||
select '', length('');
|
select '', length('');
|
||||||
--enable_view_protocol
|
--enable_view_protocol
|
||||||
|
|
||||||
#enable after fix MDEV-28696
|
|
||||||
--disable_view_protocol
|
|
||||||
select b'', 0+b'';
|
select b'', 0+b'';
|
||||||
|
|
||||||
select x'', 0+x'';
|
select x'', 0+x'';
|
||||||
--enable_view_protocol
|
|
||||||
|
|
||||||
--error ER_BAD_FIELD_ERROR
|
--error ER_BAD_FIELD_ERROR
|
||||||
select 0x;
|
select 0x;
|
||||||
|
@ -6905,5 +6905,13 @@ deallocate prepare stmt;
|
|||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
#
|
#
|
||||||
|
# MDEV-28696 View created as "select b''; " references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||||
|
#
|
||||||
|
CREATE VIEW v1 as select b'';
|
||||||
|
SELECT * FROM v1;
|
||||||
|
b''
|
||||||
|
|
||||||
|
DROP VIEW v1;
|
||||||
|
#
|
||||||
# End of 10.3 tests
|
# End of 10.3 tests
|
||||||
#
|
#
|
||||||
|
@ -6644,6 +6644,15 @@ deallocate prepare stmt;
|
|||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-28696 View created as "select b''; " references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE VIEW v1 as select b'';
|
||||||
|
SELECT * FROM v1;
|
||||||
|
DROP VIEW v1;
|
||||||
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.3 tests
|
--echo # End of 10.3 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
19
sql/item.cc
19
sql/item.cc
@ -7409,6 +7409,25 @@ Item_bin_string::Item_bin_string(THD *thd, const char *str, size_t str_length):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Item_bin_string::print(String *str, enum_query_type query_type)
|
||||||
|
{
|
||||||
|
if (!str_value.length())
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Historically a bit string such as b'01100001'
|
||||||
|
prints itself in the hex hybrid notation: 0x61
|
||||||
|
In case of an empty bit string b'', the hex hybrid
|
||||||
|
notation would result in a bad syntax: 0x
|
||||||
|
So let's print empty bit strings using bit string notation: b''
|
||||||
|
*/
|
||||||
|
static const LEX_CSTRING empty_bit_string= {STRING_WITH_LEN("b''")};
|
||||||
|
str->append(empty_bit_string);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Item_hex_hybrid::print(str, query_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_temporal_literal::eq(const Item *item, bool binary_cmp) const
|
bool Item_temporal_literal::eq(const Item *item, bool binary_cmp) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
@ -4490,6 +4490,7 @@ class Item_bin_string: public Item_hex_hybrid
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Item_bin_string(THD *thd, const char *str, size_t str_length);
|
Item_bin_string(THD *thd, const char *str, size_t str_length);
|
||||||
|
void print(String *str, enum_query_type query_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user