dolt
dolt copied to clipboard
Nonreserved keywords require escaping
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