Issue Details (XML | Word | Printable)

Key: NUCRDBMS-496
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Andy Jefferson
Reporter: KC Berg
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

Support for PostgreSQL's "SIMILAR TO" operator

Created: 03/Feb/11 09:24 PM   Updated: 07/Mar/11 05:37 PM   Resolved: 24/Feb/11 05:41 PM
Component/s: Queries
Affects Version/s: 2.2.2, 3.0.0.m1
Fix Version/s: 3.0.0.m2

File Attachments: 1. Java Source File StringMatchesPostgresMethod.java (3 kB)

Environment: Postgresql 8.4 and up

Forum Thread URL: http://www.datanucleus.org/servlet/forum/viewthread_thread,6522
Datastore: PostgreSQL
Severity: Production


 Description  « Hide
Using String.matches against Postgresql doesn't support all regex patterns. This is due to postgresql using the "SIMILAR TO" operator for advanced regex and not the "LIKE" operator. See postgresql docs for more info: http://www.postgresql.org/docs/8.4/static/functions-matching.html



Sort Order: Ascending order - Click to sort in descending order
KC Berg added a comment - 03/Feb/11 09:26 PM
I've attached a patch for this issue but it fails one of the unit tests, see forum link for details. When I figure out a way to support the unit test case I'll upload a new patch, but I figured I'd upload what I currently have so others may use it, as it is working well in my environment.

Andy Jefferson added a comment - 24/Feb/11 05:41 PM
Added to SVN (3.0) as mapping to the JDOQL syntax
String.similarTo(...)
so it is accessible for postgresql under that name. If you find a way of allowing it as a default "String.matches" then raise a new JIRA with a patch for the changes.