Skip to content

Fix syntax error near integer, and value NIL #1128

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

Merged
merged 2 commits into from
Apr 11, 2020
Merged

Fix syntax error near integer, and value NIL #1128

merged 2 commits into from
Apr 11, 2020

Conversation

MrSaints
Copy link
Contributor

@MrSaints MrSaints commented Apr 7, 2020

Since pgloader @ 11970bb, importing from MySQL 5.7 to Postgresql 11
with SSL triggers the following exception:

 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 'integer'

Rather than casting to integer, we should be casting to unsigned
or calling floor(..).

Since `pgloader` @ 11970bb, importing from MySQL 5.7 to Postgresql 11
with SSL triggers the following exception:

```
 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 'integer'
```

Rather than casting to `integer`, we should be casting to `unsigned`
or calling `floor(..)`.
@dimitri
Copy link
Owner

dimitri commented Apr 7, 2020

Can you see #1127 and add a COALESCE to your query so that empty tables with a NULL result there are covered too? or maybe that's not necessary with your version of the SQL query?

@MrSaints
Copy link
Contributor Author

MrSaints commented Apr 7, 2020

I can try that, but I actually tried my version too, and it appears to work fine with it versus without it.

EDIT: I have a feeling that issue you linked is not related, but is indeed, another potential problem.

@MrSaints
Copy link
Contributor Author

MrSaints commented Apr 7, 2020

I've pushed a fix for #1127 as well @dimitri.

I tested it without it, and it breaks when you have an empty table. But, with the COALESCE, and the fix to the cast, it all works.

Minimal reproduction w/ fixes: https://streamable.com/hp6xj9

@MrSaints MrSaints changed the title Fix syntax error near integer Fix syntax error near integer, and value NIL Apr 8, 2020
@dimitri dimitri merged commit cb989e1 into dimitri:master Apr 11, 2020
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 this pull request may close these issues.

2 participants