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

[db-sync] Escape column names #11196

Merged
merged 1 commit into from
Jul 7, 2022
Merged

[db-sync] Escape column names #11196

merged 1 commit into from
Jul 7, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Jul 7, 2022

Description

When DB sync runs on on

"SELECT id, userId, name, key, fingerprint, deleted, _lastModified, creationTime, lastUsedTime FROM d_b_user_ssh_public_key WHERE _lastModified >= '2022-07-07 08:24:39.562'"

It fails with

 "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 'key, fingerprint, deleted, _lastModified, creationTime, lastUsedTime FROM d_b_us' at line 1"

This is because of name and key are keywords in SQL. This fixes it.

Also, we shouldn't string roll an ORM model... :/

Related Issue(s)

Fixes #

How to test

Release Notes

NONE

Documentation

NONE

Werft options:

  • /werft with-preview

@roboquat roboquat merged commit e334d9e into main Jul 7, 2022
@roboquat roboquat deleted the mp/db-sync-escape-2 branch July 7, 2022 08:59
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/XS team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants