Open SimonRichardson opened 6 days ago
One option is to enable a debug mode, which could input the original statement as a comment, thus allowing it to be grep-able.
-- SELECT (u.external) AS (&dbPermissionUser.*),
-- (p.access_type, p.uuid) AS (&dbPermission.*)
-- FROM v_user_auth u
-- LEFT JOIN v_permission p ON u.uuid = p.grant_to AND p.grant_on = $dbPermission.grant_on
-- WHERE u.name = $dbPermissionUser.name
-- AND u.disabled = false
-- AND u.removed = false
SELECT u.external AS _sqlair_0,
p.access_type AS _sqlair_1, p.uuid AS _sqlair_2
FROM v_user_auth u
LEFT JOIN v_permission p ON u.uuid = p.grant_to AND p.grant_on = @sqlair_0
WHERE u.name = @sqlair_1
AND u.disabled = false
AND u.removed = false
Another alternative approach is to add a line number/position/file.
-- state.go:118
SELECT u.external AS _sqlair_0,
p.access_type AS _sqlair_1, p.uuid AS _sqlair_2
FROM v_user_auth u
LEFT JOIN v_permission p ON u.uuid = p.grant_to AND p.grant_on = @sqlair_0
WHERE u.name = @sqlair_1
AND u.disabled = false
AND u.removed = false
I'm not expecting this to be solved now (or ever), but just an observation. Once queries have been transpiled from sqliar to SQL, locating the original query is no longer just a grep.
Consider the following output in the logs:
This was the original output: