We're updating the issue view to help you get more done. 

Use postgresql SIMILAR TO instead of LIKE

Description

The postgresql SIMILAR TO function is fully compatible with LIKE but additionally it supports some regular expressions.

http://www.postgresql.org/docs/8.4/static/functions-matching.html#FUNCTIONS-SIMILARTO-REGEXP

With this simple patch:

1 2 3 4 5 6 7 8 9 10 11 diff -r 2fbfe2612bde org.compiere.db.postgresql.provider/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java --- a/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java Wed Apr 16 09:17:02 2014 -0500 +++ b/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java Wed Apr 16 10:06:49 2014 -0500 @@ -47,6 +47,7 @@ s_pg.put("\\bBLOB\\b", "BYTEA"); // BLOB not directly supported s_pg.put("\\bCLOB\\b", "TEXT"); // CLOB not directly supported s_pg.put("\\bLIMIT\\b","\"limit\""); + s_pg.put("\\bLIKE\\b","SIMILAR TO"); // replace the LIKE for the stronger SIMILAR TO s_pg.put("\\bACTION\\b","\"action\""); s_pg.put("\\bold\\b","\"old\""); s_pg.put("\\bnew\\b","\"new\"");

I was able to make it work.

It would be good to add this to iDempiere? Configurable?

WDYT?

Regards,

Carlos Ruiz

Environment

None

Status

Assignee

Carlos Ruiz

Reporter

Carlos Ruiz

Labels

Tested By

None

Priority

Major