Skip to content

Error messages with code above 4000 on MariaDB are not displayed #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
antoinecarme opened this issue Jun 26, 2017 · 7 comments · Fixed by #188
Closed

Error messages with code above 4000 on MariaDB are not displayed #187

antoinecarme opened this issue Jun 26, 2017 · 7 comments · Fixed by #188

Comments

@antoinecarme
Copy link

Hello,

When using a model with too many CTEs, I get the error

Code: 4003 SQL State: HY000 Too many WITH elements in WITH clause

when doing an explain but the python client/driver (MySQLdb) does not display it and it displayed an cryptic error (''error totally whack').

A deeper source code analysis shows that the python code expects an error code to be below CR_MAX_ERROR

        merr = mysql_errno(&(c->connection));
        if (!merr)
                e = _mysql_InterfaceError;
        else if (merr > CR_MAX_ERROR) {
                PyTuple_SET_ITEM(t, 0, PyInt_FromLong(-1L));
                PyTuple_SET_ITEM(t, 1, PyString_FromString("error totally whack"));
                PyErr_SetObject(_mysql_InterfaceError, t);
                Py_DECREF(t);
                return NULL;
        }

but CR_MAX_ERROR is defined by mariadb as ,

../server/include/errmsg.h:#define CR_MAX_ERROR 2999

Did this number increase without (mariadb | python-driver) being updated ?

Thanks in advance,

Antoine

PS: I already filed a bug with mariadb here : https://jira.mariadb.org/browse/MDEV-12990

@antoinecarme antoinecarme changed the title Error message with code above 4000 on MariaDB are not diaplyed Error message with code above 4000 on MariaDB are not displayed Jun 26, 2017
@antoinecarme antoinecarme changed the title Error message with code above 4000 on MariaDB are not displayed Error messages with code above 4000 on MariaDB are not displayed Jun 26, 2017
@methane
Copy link
Member

methane commented Jun 26, 2017

It's not business of this project.
Link with libmariadbclient.

@methane methane closed this as completed Jun 26, 2017
@antoinecarme
Copy link
Author

Excellent!!!

Thanks for the quick response.

@vuvova
Copy link

vuvova commented Jun 26, 2017

It is business of this project, certainly. The check

        else if (merr > CR_MAX_ERROR) {

is wrong both for MariaDB and MySQL. There is no client library where CR_MAX_ERROR is the highest possible error number. It is (and always was) highest possible client error number. Server error numbers can be both below and above that. In MariaDB and in MySQL.

@antoinecarme
Copy link
Author

antoinecarme commented Jun 26, 2017

Nice to see the developer of mariadb (@vuvova) discussing with python driver developer (@methane) to help solve my issue.

Cheers !!

@methane methane reopened this Jun 27, 2017
@methane
Copy link
Member

methane commented Jun 27, 2017

I'm sorry. I received mail about building almost every day and totally tired.
So I hadn't read your issue carefully.

@vuvova
Copy link

vuvova commented Jun 27, 2017

No problem! Thanks for the quick fix!

@antoinecarme
Copy link
Author

Guys,

You made my day. Perfect.

After a git fetch and rebase, reinstall, I now get the real message in my tests ;)

TEST_STATUS GradientBoostingClassifier_('db2', 'db2+ibm_db://db:db@localhost:50000/db')_None success None
TEST_STATUS GradientBoostingClassifier_('sqltm', 'sqlite://')_None success None
TEST_STATUS GradientBoostingClassifier_('mssql', 'mssql+pymssql://sa:Micro123@SklearnTestDB/db?charset=utf8&timeout=180')_None success None
TEST_STATUS GradientBoostingClassifier_('pgsql', 'postgresql://db:db@localhost/db?port=5432')_None success None
TEST_STATUS GradientBoostingClassifier_('mysql', 'mysql://db:db@localhost/db')_None failure OperationalError:(_mysql_exceptions.OperationalError) (4003, 'Too many WITH elements in WITH clause') [SQL: "WITH `DT_node_lookup` AS \n(SELECT `ADS`.`index` AS `index`, CASE WHEN (`ADS`.`XD_50` <= -0.4414560794830322
TEST_STATUS GradientBoostingClassifier_('oracle', 'oracle+cx_oracle://db:dba@xe')_None success None

Thanks a lot for keeping the quality of mariadb and its python driver at this level.

Regards,

Antoine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants