[jira] [Commented] (OFBIZ-7129) Recognise "BASE TABLE" table type in metadata

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-7129) Recognise "BASE TABLE" table type in metadata

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-7129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15665661#comment-15665661 ]

Paul Foxworthy commented on OFBIZ-7129:
---------------------------------------

I've now checked SQL 99 (https://mariadb.com/kb/en/sql-99/information_schematables/) and SQL 2011 (Download draft from http://www.wiscorp.com/sql20nn.zip). The actual SQL standards documents would cost money.

In both cases, the value ought to be "BASE TABLE". It's unfortunate Sun/Oracle didn't say so in their documentation of the getTables method.

Despite the fact my patch is not strictly necessary for MariaDB, I'm inclined to commit it. In future, another database might come along and implement standards-based SQL. Whoever writes a JDBC driver may not be aware that getTables is documented to deliver something different to the standard.

My change will make startup of OFBiz fractionally slower, but mean it accepts the SQL standard value. If there are no objections, I'll commit this in a few days.

> Recognise "BASE TABLE" table type in metadata
> ---------------------------------------------
>
>                 Key: OFBIZ-7129
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-7129
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Paul Foxworthy
>            Assignee: Paul Foxworthy
>         Attachments: OFBIZ-7129_BaseTableMetadata.patch, OFBIZ-7129_BaseTableMetadata.patch
>
>
> In framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java, the getTableNames method looks for table types of "TABLE", "VIEW", "ALIAS" and "SYNONYM" (https://fisheye6.atlassian.com/browse/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?r=1644354#to989).
> MariaDB produces a table type of "BASE TABLE", so OFBiz didn't detect the tables were there, and attempted to create them. In fact, the tables do exist so the create failed.
> The JDBC docs suggest that plain "TABLE" is a "typical" value for table type (https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getTables-java.lang.String-java.lang.String-java.lang.String-java.lang.String:A-)
> But it seems "BASE TABLE" is more standards compliant - see for example http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt page 576. I assume some JDBC drivers transform "BASE TABLE" to plain "TABLE", but the MariaDB one does not.
> I've attached a patch so OFBiz will recognise "BASE TABLE" if that's what it receives in the metadata.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)