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

Bruno Dumon commented on PHOENIX-1366:
--------------------------------------

I should have though of this.

I have attached a patch. Besides ORDINAL_POSITION, I also shifted the KEY_SEQ.

I had to introduce an extra alias column ORIGINAL_ORDINAL_POSITION because the 
following query fails:

select case when override_ordinal_position then ordinal_position -1 else 
ordinal_position end as ordinal_position from system.catalog 
(override_ordinal_position boolean) order by ordinal_position;

with:

Error: ERROR 502 (42702): Column reference ambiguous or duplicate names. 
columnName=ORDINAL_POSITION (state=42702,code=502)

This is due to the order by.

To set the flag column, I have manipulated the Result in the ResultTuple. If 
there are better ways, just let me know.

> ORDINAL_POSITION incorrect for multi-tenant table over tenant-specific 
> connection
> ---------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1366
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1366
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>         Attachments: PHOENIX-1366.patch
>
>
> We strip out the tenant ID column from our 
> connection.getMetaData().getColumns() call for a multi-tenant table over a 
> tenant-specific connection as of PHOENIX-1271. However, in doing so, we 
> should adjust down the ORDINAL_POSITION by one for every column *after* the 
> tenant ID column.



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

Reply via email to