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

Nonreserved keywords require escaping #3977

Closed
pbowyer opened this issue Jul 30, 2022 · 1 comment
Closed

Nonreserved keywords require escaping #3977

pbowyer opened this issue Jul 30, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@pbowyer
Copy link

pbowyer commented Jul 30, 2022

Possibly related to #3976:

error=syntax error at position 34 near 'Event', 
query=SELECT Event.name AS `event`, PluginEvent.pluginid, PropertySet.name AS propertyset FROM `abcx_site_plugin_events` PluginEvent INNER JOIN `abcx_site_plugins` Plugin ON Plugin.id = PluginEvent.pluginid AND Plugin.disabled = 0 INNER JOIN `abcx_system_eventnames` Event ON Event.service IN (1,3,4,5,6) AND Event.name = PluginEvent.event LEFT JOIN `abcx_property_set` PropertySet ON PluginEvent.propertyset = PropertySet.id ORDER BY Event.name, PluginEvent.priority ASC

Event is a nonreserved keyword and the MySQL manual says:

Nonreserved keywords are permitted as identifiers without quoting. Reserved words are permitted as identifiers if you quote them as described in Section 9.2, “Schema Object Names”:

To make the query work with Dolt I have to quote all uses of Event:

SELECT `Event`.name AS `event`, PluginEvent.pluginid, PropertySet.name AS propertyset 
FROM `abcx_site_plugin_events` PluginEvent 
INNER JOIN `abcx_site_plugins` Plugin ON Plugin.id = PluginEvent.pluginid AND Plugin.disabled = 0 
INNER JOIN `abcx_system_eventnames` `Event` ON `Event`.service IN (1,3,4,5,6) AND `Event`.name = PluginEvent.event 
LEFT JOIN `abcx_property_set` PropertySet ON PluginEvent.propertyset = PropertySet.id 
ORDER BY `Event`.name, PluginEvent.priority ASC
@timsehn
Copy link
Contributor

timsehn commented Aug 12, 2022

This is fixed in the above PR which is now released.

@timsehn timsehn closed this as completed Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants