You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Taher Alkhateeb <sl...@gmail.com> on 2016/09/04 09:15:27 UTC

Re: svn commit: r1759155 - /ofbiz/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java

Hi Shi,

I can see this is related to OFBIZ-8137 right?

Anyway, are you sure this is the correct fix? The original condition says
if the table name does not start with the schema name, then append the
schema name. This is used because Postgres 7.3 did not include the schema
name. Your fix is to add the schema name followed by "dot" right? What if
the table name contains the schema name followed by a dot (it is a legal
character) then you are back to the same issue no?

Maybe I missed something that you caught while debugging, but just wanted
to highlight because the fix seems a bit odd.

Taher Alkhateeb

On Sun, Sep 4, 2016 at 11:57 AM, <sh...@apache.org> wrote:

> Author: shijh
> Date: Sun Sep  4 08:57:44 2016
> New Revision: 1759155
>
> URL: http://svn.apache.org/viewvc?rev=1759155&view=rev
> Log:
> OFBIZ-8137 Entityname starts with schema name causes error in PostgreSQL
>
> Modified:
>     ofbiz/trunk/framework/entity/src/main/java/org/apache/
> ofbiz/entity/jdbc/DatabaseUtil.java
>
> Modified: ofbiz/trunk/framework/entity/src/main/java/org/apache/
> ofbiz/entity/jdbc/DatabaseUtil.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/
> src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java?rev=1759155&
> r1=1759154&r2=1759155&view=diff
> ============================================================
> ==================
> --- ofbiz/trunk/framework/entity/src/main/java/org/apache/
> ofbiz/entity/jdbc/DatabaseUtil.java (original)
> +++ ofbiz/trunk/framework/entity/src/main/java/org/apache/
> ofbiz/entity/jdbc/DatabaseUtil.java Sun Sep  4 08:57:44 2016
> @@ -1001,7 +1001,7 @@ public class DatabaseUtil {
>                      String tableName = tableSet.getString("TABLE_NAME");
>                      // for those databases which do not return the schema
> name with the table name (pgsql 7.3)
>                      boolean appendSchemaName = false;
> -                    if (tableName != null && lookupSchemaName != null &&
> !tableName.startsWith(lookupSchemaName)) {
> +                    if (tableName != null && lookupSchemaName != null &&
> !tableName.startsWith(lookupSchemaName + "\\.")) {
>                          appendSchemaName = true;
>                      }
>                      if (needsUpperCase && tableName != null) {
> @@ -3042,7 +3042,7 @@ public class DatabaseUtil {
>              String tableName = rawTableName;
>              // for those databases which do not return the schema name
> with the table name (pgsql 7.3)
>              boolean appendSchemaName = false;
> -            if (tableName != null && lookupSchemaName != null &&
> !tableName.startsWith(lookupSchemaName)) {
> +            if (tableName != null && lookupSchemaName != null &&
> !tableName.startsWith(lookupSchemaName + "\\.")) {
>                  appendSchemaName = true;
>              }
>              if (needsUpperCase && tableName != null) {
>
>
>