maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #11498
Re: b0d21b7: MDEV-14567 Include full name of object in message about incorrect value for column.
Hi, Alexey!
On Nov 04, Alexey Botchkov wrote:
> revision-id: b0d21b7832cea92522d0f8d280ceb8b13b335cbf (mariadb-10.2.18-56-gb0d21b7)
> parent(s): 1c6b982e02eeaa75bb6c2f2a3c2b64491dd6d3c8
> committer: Alexey Botchkov
> timestamp: 2018-11-04 09:14:40 +0400
> message:
>
> MDEV-14567 Include full name of object in message about incorrect value for column.
Wrong MDEV number again. It should be MDEV-14576
>
> Put the full field name in the ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
> error message.
>
> +static char *long_field_name(char *buf, size_t buf_len,
> + const TABLE_SHARE *s, const char *field_name)
> +{
> + bool is_temp= !s||
> + (tmp_file_prefix_length < s->table_name.length &&
> + memcmp(s->table_name.str,
> + tmp_file_prefix, tmp_file_prefix_length) == 0);
> +
> + if (is_temp)
> + strxnmov(buf, buf_len, "{temporary}.", field_name, NullS);
> + else
> + strxnmov(buf, buf_len,
> + s->db.str, ".", s->table_name.str, ".", field_name, NullS);
> +
> + return buf;
> +}
> +
> +
> int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
> {
> if (!length)
> @@ -8620,10 +8638,11 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
> geom_type != Field::GEOM_GEOMETRYCOLLECTION &&
> (uint32) geom_type != wkb_type)
> {
> + char buf[193];
> my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
> Geometry::ci_collection[geom_type]->m_name.str,
> Geometry::ci_collection[wkb_type]->m_name.str,
> - field_name,
> + long_field_name(buf, sizeof(buf), table->s, field_name),
> (ulong) table->in_use->get_stmt_da()->
> current_row_for_warning());
> goto err_exit;
Better change the error message to be
Incorrect decimal value: '%s' for column %`s.%`s.%`s at row %d
and use like
my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
Geometry::ci_collection[geom_type]->m_name.str,
Geometry::ci_collection[wkb_type]->m_name.str,
- field_name,
+ table->s->db.str, table->s->table_name.str, field_name,
(ulong) table->in_use->get_stmt_da()->
current_row_for_warning());
What would that do for temporary tables?
Anyway, the correct quoting is still `db`.`table`.`column`, not
'db.table.column'.
Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx