Bug #108027 The number of attributes is larger than the number of attribute values provided
Submitted: 29 Jul 2022 8:43 Modified: 27 Oct 2022 11:23
Reporter: Dennis Lim Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:8.0.30 OS:Windows (10 21H1)
Assigned to: MySQL Verification Team CPU Architecture:x86 (Intel i7 8th Gen)
Tags: attributes is larger than the number of attribute values

[29 Jul 2022 8:43] Dennis Lim
Description:
Hi.

This I believe is the offending code:

select count(*) as totrecs from pihdr a left join supplier b on a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id left join jthdr d on a.jthdrid=d.id

It does not show in the ODBC trace I have pasted below. I also tried substituting it with:

select SQL_CALC_FOUND_ROWS * from pihdr a left join supplier b on a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id left join jthdr d on a.jthdrid=d.id

select FOUND_ROWS() as totrecs 

************ part of the ODBC Trace Log **************

vfp9.exe" -cMET 26ac-1e04	EXIT  SQLExecDirect  with return code -1 (SQL_ERROR)
		HSTMT               0x02A03B00
		UCHAR *             0x0091AED0 [      -3] "\ 0"
		SDWORD                    -3

		DIAG [01000] [MySQL][ODBC 8.0(w) Driver][mysqld-8.0.30]The number of attributes is larger than the number of attribute values provided (500) 

vfp9.exe" -cMET 26ac-1e04	ENTER SQLPrepare 
		HSTMT               0x02A03B00
		UCHAR *             0x034C12A8 [      -3] "select a.*, b.code as supcode, b.descriptor as supname, c.code as ewtaxcode, c.descriptor as ewtaxname, d.code as jtcode, d.descriptor as jtname from pihdr a left join supplier b on a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id left join jthdr d on a.jthdrid=d.id\ 0"
		SDWORD                    -3

vfp9.exe" -cMET 26ac-1e04	EXIT  SQLPrepare  with return code 0 (SQL_SUCCESS)
		HSTMT               0x02A03B00
		UCHAR *             0x034C12A8 [      -3] "select a.*, b.code as supcode, b.descriptor as supname, c.code as ewtaxcode, c.descriptor as ewtaxname, d.code as jtcode, d.descriptor as jtname from pihdr a left join supplier b on a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id left join jthdr d on a.jthdrid=d.id\ 0"
		SDWORD                    -3

vfp9.exe" -cMET 26ac-1e04	ENTER SQLNumResultCols 
		HSTMT               0x02A03B00
		SWORD *             0x0019BAF0

vfp9.exe" -cMET 26ac-1e04	EXIT  SQLNumResultCols  with return code 0 (SQL_SUCCESS)
		HSTMT               0x02A03B00
		SWORD *             0x0019BAF0 (37)

vfp9.exe" -cMET 26ac-1e04	ENTER SQLNumResultCols 
		HSTMT               0x02A03B00
		SWORD *             0x0019B5DC

vfp9.exe" -cMET 26ac-1e04	EXIT  SQLNumResultCols  with return code 0 (SQL_SUCCESS)
		HSTMT               0x02A03B00
		SWORD *             0x0019B5DC (37)

vfp9.exe" -cMET 26ac-1e04	ENTER SQLColAttributes 
		HSTMT               0x02A03B00
		UWORD                        1 
		UWORD                        6 <SQL_COLUMN_DISPLAY_SIZE>
		PTR                0x00000000
		SWORD                        0 
		SWORD *             0x00000000
		SQLLEN *            0x0019B540

vfp9.exe" -cMET 26ac-1e04	EXIT  SQLColAttributes  with return code 0 (SQL_SUCCESS)
		HSTMT               0x02A03B00
		UWORD                        1 
		UWORD                        6 <SQL_COLUMN_DISPLAY_SIZE>
		PTR                0x00000000
		SWORD                        0 
		SWORD *             0x00000000
		SQLLEN *            0x0019B540 (8)

vfp9.exe" -cMET 26ac-1e04	ENTER SQLColAttributes 
		HSTMT               0x02A03B00
		UWORD                        1 
		UWORD                        9 <SQL_COLUMN_MONEY>
		PTR                0x00000000
		SWORD                        0 
		SWORD *             0x00000000
		SQLLEN *            0x0019B540

How to repeat:
This I believe is the offending code.

select count(*) as totrecs from pihdr a left join supplier b on a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id left join jthdr d on a.jthdrid=d.id

It does not show in the ODBC trace above. I also tried substituting it with:

select SQL_CALC_FOUND_ROWS * from pihdr a left join supplier b on a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id left join jthdr d on a.jthdrid=d.id

select FOUND_ROWS() as totrecs 

Both do not show in the trace log, but shows:

The number of attributes is larger than the number of attribute values provided

Suggested fix:
No idea sir. I also looked into changing character sets. No luck at all.
[29 Jul 2022 12:15] MySQL Verification Team
Hi Mr. Lim,

Thank you for your bug report.

You have filed your report as belonging to the MySQL server, while it is evident that it belongs to our ODBC driver.

In order to proceed you should send us your entire test case, including a set of SQL statements that create and populate tables in question , plus your ODBC code ......
[29 Jul 2022 12:26] Dennis Lim
Before reading below, my code works with MySQL ODBC 8.0.30 and MySQL Server 5.7.37 perfectly... when I run it with MySQL ODBC 8.0.30 and MySQL Server 8.0.30.. that is where the errors appear...

My guess is that it is not the ODBC version that is in question.. but the Server version... (I maybe wrong though if I am given a better explanation)..

******************

This I believe is the offending code:

select count(*) as totrecs from pihdr a left join supplier b on
a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id left join jthdr d
on a.jthdrid=d.id

It does not show in the ODBC trace I have pasted below. I also tried
substituting it with:

select SQL_CALC_FOUND_ROWS * from pihdr a left join supplier b on
a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id left join jthdr d
on a.jthdrid=d.id

select FOUND_ROWS() as totrecs

************ part of the ODBC Trace Log **************

vfp9.exe" -cMET 26ac-1e04       EXIT  SQLExecDirect  with return code -1
(SQL_ERROR)
                HSTMT               0x02A03B00
                UCHAR *             0x0091AED0 [      -3] "\ 0"
                SDWORD                    -3

                DIAG [01000] [MySQL][ODBC 8.0(w) Driver][mysqld-8.0.30]The number of
attributes is larger than the number of attribute values provided (500)

vfp9.exe" -cMET 26ac-1e04       ENTER SQLPrepare
                HSTMT               0x02A03B00
                UCHAR *             0x034C12A8 [      -3] "select a.*, b.code as
supcode, b.descriptor as supname, c.code as ewtaxcode, c.descriptor as
ewtaxname, d.code as jtcode, d.descriptor as jtname from pihdr a left
join supplier b on a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id
left join jthdr d on a.jthdrid=d.id\ 0"
                SDWORD                    -3

vfp9.exe" -cMET 26ac-1e04       EXIT  SQLPrepare  with return code 0
(SQL_SUCCESS)
                HSTMT               0x02A03B00
                UCHAR *             0x034C12A8 [      -3] "select a.*, b.code as
supcode, b.descriptor as supname, c.code as ewtaxcode, c.descriptor as
ewtaxname, d.code as jtcode, d.descriptor as jtname from pihdr a left
join supplier b on a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id
left join jthdr d on a.jthdrid=d.id\ 0"
                SDWORD                    -3

vfp9.exe" -cMET 26ac-1e04       ENTER SQLNumResultCols
                HSTMT               0x02A03B00
                SWORD *             0x0019BAF0

vfp9.exe" -cMET 26ac-1e04       EXIT  SQLNumResultCols  with return code 0
(SQL_SUCCESS)
                HSTMT               0x02A03B00
                SWORD *             0x0019BAF0 (37)

vfp9.exe" -cMET 26ac-1e04       ENTER SQLNumResultCols
                HSTMT               0x02A03B00
                SWORD *             0x0019B5DC

vfp9.exe" -cMET 26ac-1e04       EXIT  SQLNumResultCols  with return code 0
(SQL_SUCCESS)
                HSTMT               0x02A03B00
                SWORD *             0x0019B5DC (37)

vfp9.exe" -cMET 26ac-1e04       ENTER SQLColAttributes
                HSTMT               0x02A03B00
                UWORD                        1
                UWORD                        6 <SQL_COLUMN_DISPLAY_SIZE>
                PTR                0x00000000
                SWORD                        0
                SWORD *             0x00000000
                SQLLEN *            0x0019B540

vfp9.exe" -cMET 26ac-1e04       EXIT  SQLColAttributes  with return code 0
(SQL_SUCCESS)
                HSTMT               0x02A03B00
                UWORD                        1
                UWORD                        6 <SQL_COLUMN_DISPLAY_SIZE>
                PTR                0x00000000
                SWORD                        0
                SWORD *             0x00000000
                SQLLEN *            0x0019B540 (8)

vfp9.exe" -cMET 26ac-1e04       ENTER SQLColAttributes
                HSTMT               0x02A03B00
                UWORD                        1
                UWORD                        9 <SQL_COLUMN_MONEY>
                PTR                0x00000000
                SWORD                        0
                SWORD *             0x00000000
                SQLLEN *            0x0019B540

How to repeat:
This I believe is the offending code.

select count(*) as totrecs from pihdr a left join supplier b on
a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id left join jthdr d
on a.jthdrid=d.id

It does not show in the ODBC trace above. I also tried substituting it
with:

select SQL_CALC_FOUND_ROWS * from pihdr a left join supplier b on
a.supplierid=b.id left join ewtax c on a.ewtaxid=c.id left join jthdr d
on a.jthdrid=d.id

select FOUND_ROWS() as totrecs

Both do not show in the trace log, but shows:

The number of attributes is larger than the number of attribute values
provided
[27 Sep 2022 11:23] MySQL Verification Team
Hello Dennis Lim,

Thank you for the bug report.
Could you please run the same query via MySQL command line and see if it fails even in MySQL Server 8.0.30?

Regards,
Ashwini Patil
[28 Oct 2022 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".