Bug #21089 mysqltest doesn't print warnings produced by mysql_prepare(stmt-with-resultset)

Submitted: 17 Jul 2006 1:48 Modified: 12 Jan 2011 12:05
Reporter: Sergey Petrunya Email Updates:
Status: Duplicate Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any

[17 Jul 2006 1:48] Sergey Petrunya
Description:
mysqltest client doesn't print warnings produced by mysql_prepare(statement-with-resultset).

How to repeat:
Create a .test file with this contents:
--- t/_a.test ---
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

select a+1 a from t1 group by a having a > 5;
--- t/_a.test ends---

run 
./mysql-test-run --record t/_a.test

Then run ./mysql-test-run --ps-protocol t/_a.test, and get this test failure:

-------------------------------------------------------
*** r/_c.result Mon Jul 17 08:13:34 2006
--- r/_c.reject Mon Jul 17 08:13:52 2006
***************
*** 8,11 ****
  10
  Warnings:
  Warning       1052    Column 'a' in group statement is ambiguous
- Warning       1052    Column 'a' in having clause is ambiguous
--- 8,10 ----
-------------------------------------------------------
[17 Jul 2006 2:24] Sergey Petrunya
The following fix makes the mysql_prepare() warnings to be printed into test output:

 ===== mysqltest.c 1.237 vs edited =====
*** /home/psergey/mysql-5.0-opt-check/BitKeeper/tmp/bk_mysqltest.c-1.237_CH72IE 2006-07-17 10:14:37 +04:00
--- edited/mysqltest.c  2006-07-17 09:46:36 +04:00
***************
*** 3985,3991 ****
        mysql_free_result(res);     /* Free normal result set with meta data */
  
        /* Clear prepare warnings */
!       dynstr_set(&ds_prepare_warnings, NULL);
      }
      else
      {
--- 3985,3991 ----
        mysql_free_result(res);     /* Free normal result set with meta data */
  
        /* Clear prepare warnings */
!       //psergey: don't: dynstr_set(&ds_prepare_warnings, NULL);
      }
      else
      {
--end of file--

However, we can't just push it. The problem is that certain warnings are retruned for both mysql_stmt_prepare() and mysql_stmt_execute(). I've already caught those:
 Incorrect date value: 'zzz' for column 'f1' at row 1
 Column 'c2' in group statement is ambiguous

Returning a warning in both mysql_stmt_prepare() and mysql_stmt_execute() causes this:
 - with --ps-protocol test result contains two copies warnings.
 - without --ps-protocol test result contains one warning.
while the testsuite (correctly) expects output to be the same with and without --ps-protocol.

 - without
[12 Jan 2011 12:05] Bjørn Munch
Duplicate of recently fixed Bug #47902

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.