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

Fix clone of embedded literal sql #119

Merged
merged 1 commit into from
May 15, 2020
Merged

Fix clone of embedded literal sql #119

merged 1 commit into from
May 15, 2020

Conversation

prust
Copy link
Collaborator

@prust prust commented May 15, 2020

This fixes #118, with a couple of tests to protect against regressions.

The docs state that sql() should be used:

somewhere that a value is expected (the right-hand side of WHERE criteria, or insert()/update() values)

and in these situations, clone() was working correctly because it doesn't clone values (which are typically immutable, though I suppose it's technically possible for someone to mutate a sql() literal).

But right after that, the docs give an example where sql() is used in a higher-level context -- not just as a value, but as the entire WHERE expression. It is in these cases that it was throwing the error, and this is what was fixed in this pull request.

I should probably update the docs to explicitly allow sql() in more contexts and should think a little harder about whether we really need/want that functionality in the big 3.x refactor (which may never happen, at this rate).

@prust prust merged commit aebaf79 into 2.x May 15, 2020
@prust prust deleted the clone-w-sql branch May 15, 2020 19:40
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.

1 participant