mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-12325 Unexpected data type and truncation when using CTE
When creating a recursive CTE, the column types are taken from the non recursive part of the CTE (this is according to the SQL standard). This patch adds code to abort the CTE if the calculated values in the recursive part does not fit in the fields in the created temporary table. The new code only affects recursive CTE, so it should not cause any notable problems for old applications. Other things: - Fixed that we get correct row numbers for warnings generated with WITH RECURSIVE Reviewer: Alexander Barkov <bar@mariadb.com>
This commit is contained in:
@ -722,6 +722,13 @@ private:
|
||||
/** Reset the current row counter. Start counting from the first row. */
|
||||
void reset_current_row_for_warning() { m_current_row_for_warning= 1; }
|
||||
|
||||
ulong set_current_row_for_warning(ulong row)
|
||||
{
|
||||
ulong old_row= m_current_row_for_warning;
|
||||
m_current_row_for_warning= row;
|
||||
return old_row;
|
||||
}
|
||||
|
||||
/** Return the current counter value. */
|
||||
ulong current_row_for_warning() const { return m_current_row_for_warning; }
|
||||
|
||||
@ -1099,6 +1106,9 @@ public:
|
||||
void opt_clear_warning_info(ulonglong query_id)
|
||||
{ get_warning_info()->opt_clear(query_id); }
|
||||
|
||||
long set_current_row_for_warning(long row)
|
||||
{ return get_warning_info()->set_current_row_for_warning(row); }
|
||||
|
||||
ulong current_row_for_warning() const
|
||||
{ return get_warning_info()->current_row_for_warning(); }
|
||||
|
||||
|
Reference in New Issue
Block a user