[ODBC-158] When performing a query with an aggregate function such as Count or Sum from MSAccess, an error is returned Created: 2018-07-10  Updated: 2018-07-15  Resolved: 2018-07-12

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.0.5
Fix Version/s: 2.0.17, 3.0.6

Type: Bug Priority: Major
Reporter: Martin Lane Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None
Environment:

Windows 7 Professional 64 bit. MS Access 2010 32 bit


Attachments: Text File MAODBC.LOG    

 Description   

When running the following query:
SELECT Count(tblContacts.contactID) AS CountOfcontactID, tblContacts.firstName
FROM tblContacts
GROUP BY tblContacts.firstName

The error returned is:
"The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data."

The error is is returned using Count, Sum, Avg, StDev and Var. But not when using Min, Max, First or Last.

This error is not generated if using the MySQL ODBC connector to connect to the same database.

connector log attached.



 Comments   
Comment by Lawrin Novitsky [ 2018-07-10 ]

Thank you for your report.
I could repeat the issue. However it's very strange. I can see nothing in the trace, that could cause the error

Comment by Lawrin Novitsky [ 2018-07-12 ]

Commit 91f7d86 in odbc-3.0/master

Comment by Lawrin Novitsky [ 2018-07-12 ]

Those aggregate functions, that caused error, return LONGLONG value, and Access was getting it as SQL_C_LONG. The problem was that connector returned length of the data as 8(field's size), and not 4(requested C-type size), as specs prescribe.

Generated at Thu Feb 08 03:26:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.