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

James Taylor commented on PHOENIX-1682:
---------------------------------------

Those are all valid and correct. I don't think this is relevant for this fix, 
though. I think the only thing we need to do is not call normalizeIdentifier in 
the PhoenixRuntime.getTable() call. The caller is responsible for passing in 
the already normalized name. This is what we've done for all DatabaseMetaData 
calls. It'd look like this instead:
{code}
    public static PTable getTable(Connection conn, String name) throws 
SQLException {
        PTable table = null;
        PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class);
        try {
            table = pconn.getMetaDataCache().getTable(new 
PTableKey(pconn.getTenantId(), name));
        } catch (TableNotFoundException e) {
            String schemaName = SchemaUtil.getSchemaNameFromFullName(name);
            String tableName = SchemaUtil.getTableNameFromFullName(name);
            MetaDataMutationResult result = new 
MetaDataClient(pconn).updateCache(schemaName, tableName);
            if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS) {
                throw e;
            }
            table = result.getTable();
        }
        return table;
    }
{code}

> PhoenixRuntime.getTable() does not work with case-sensitive table names
> -----------------------------------------------------------------------
>
>                 Key: PHOENIX-1682
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1682
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.2.0
>            Reporter: Eli Levine
>            Assignee: Ivan Weiss
>              Labels: Newbie
>
> PhoenixRuntime.getTable(conn, name) assumes _name_ is a single component 
> because it calls SchemaUtil.normalizeIdentifier(name) on the whole thing, 
> without breaking up _name_ into table name and schema name components. In 
> cases where a table is case sensitive (created with _schemaName."tableName"_) 
> this will result in getTable not finding the table.



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

Reply via email to