Skip to content
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

Use of dbDelta($creation_query) throws DESCRIBE IF error in Query Monitor #1

Open
johnny-solargard opened this issue Mar 4, 2019 · 2 comments

Comments

@johnny-solargard
Copy link

When using the newest version 2.9.3 I get the following error on Query Monitor:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘IF’ at line 1

Files affected:

/plugins/mailin/model/model-forms.php:56
/plugins/mailin/model/model-users.php:44
/plugins/mailin/model/model-lang.php:32

This seems to be related to using the dbDelta() function along with the syntax of the SQL statement around “CREATE TABLE IF NOT EXISTS”

The dbDelta() function will interpret “IF” as the table name which throws everything off.

I got this to work by using $wpdb->query($creation_query) instead of dbDelta($creation_query)

@NielsdeBlaauw
Copy link

We are noticing the same error on our services. Any update available @sendinblue?

@DanielRuf
Copy link

Better drop the IF NOT EXISTS part: https://developer.wordpress.org/reference/functions/dbdelta/#comment-5413

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

No branches or pull requests

3 participants