Bug: Warnings not displayed for multiple SQL statements.

[expired user #8393]'s profile image [expired user #8393] posted 9 years ago in Running SQL scripts Permalink
Hi.

Using the following SQL statements ...

update zreads set zreads.eposReleaseDate = '2015-01-13T12:34:12.017Z' where zreads.zReadID = 2;
select * from zreads where zreads.zreadid = 1;


results in a warning about truncation on the eposReleaseDate. The warning is correct, but with both of the statements being executed, the actual message is not displayed.

Instead the dialogue shows ...

"Warning

Your query produced 1 warnings.

Warnings from your last query:

[OK]
"

No actual warning.

Remove the select statement and the dialog correctly displays ...

"Warning

Your query produced 1 warnings.

Warnings from your last query:
Warning: Data truncated for column 'eposReleaseDate' at row 1

[OK]
"

The log at the bottom of the application doesn't show the warning either way; i.e. executing single or multiple statements.

Regards,

Richard Quadling.
ansgar's profile image ansgar posted 9 years ago Permalink
Confirmed. I guess I did not read this when implementing that warning stuff:

http://dev.mysql.com/doc/refman/5.0/en/show-warnings.html

SHOW WARNINGS displays information about the conditions resulting from the most recent statement in the current session that generated messages. It shows nothing if the most recent statement used a table and generated no messages. (That is, statements that use a table but generate no messages clear the message list.) Statements that do not use tables and do not generate messages have no effect on the message list.



Hm. I don't see a way to fix that, apart from displaying the warnings before a SELECT query is fired?
ansgar's profile image ansgar posted 9 years ago Permalink
Ah, and not only SELECT queries clear the message list. Also UPDATEs seem to do that. I can't find the exact definition for a "statement that uses a table". But I guess it's exactly that - as soon as there is a table read from or written to, the messages are cleared. Shit.
[expired user #8393]'s profile image [expired user #8393] posted 9 years ago Permalink
Maybe you could add a little bit extra text with a link to the dox explaining why no error messages are displayed.
immobilia's profile image immobilia posted 3 years ago Permalink

I continue this discution in another topic : "SHOW WARNINGS following CREATE TABLE"

Please login to leave a reply, or register at first.