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

Invalid key error when merging to targets due to trailing spaces #67

Open
atomashpolskiy opened this issue Sep 14, 2015 · 1 comment
Open

Comments

@atomashpolskiy
Copy link
Member

Some databases like MySQL and SQL Server ignore trailing spaces when comparing strings (see this post on SO, for example). This leads to matched targets being different from sources, and consequently to an exception in com.nhl.link.move.runtime.task.createorupdate.CreateOrUpdateMerger#merge.

Example:
Source key: {foo='bar'}
Matched target (was selected by WHERE foo = 'bar'): {foo='bar '}
Note the sneaky trailing space.

I'm not sure if it's an "issue" at all, but still willing to share.

@andrus
Copy link
Contributor

andrus commented Sep 14, 2015

Yeah, as a Cayenne developer, I am very familiar with the issue (see for instance https://github.com/apache/cayenne/blob/master/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/TrimmingQualifierTranslator.java ). We will probably need to write tests with cross-DB sources at some point to see the behavior.

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

No branches or pull requests

2 participants