You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Chinmay Kulkarni (Jira)" <ji...@apache.org> on 2020/10/28 00:18:00 UTC

[jira] [Updated] (PHOENIX-6033) Unable to add back a parent column that was earlier dropped from a view

     [ https://issues.apache.org/jira/browse/PHOENIX-6033?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chinmay Kulkarni updated PHOENIX-6033:
--------------------------------------
    Fix Version/s: 4.17.0
                   4.16.1

> Unable to add back a parent column that was earlier dropped from a view
> -----------------------------------------------------------------------
>
>                 Key: PHOENIX-6033
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6033
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 5.0.0, 4.15.0
>            Reporter: Chinmay Kulkarni
>            Priority: Major
>             Fix For: 5.1.0, 4.16.0, 4.16.1, 4.17.0
>
>
> In 4.14.3, we allowed adding a column (with the same name as a column inherited from the parent) back to a view, which was dropped in the past. In 4.x this is no longer allowed.
> Start 4.x server and run the following with a 4.x client:
> {code:sql}
> CREATE TABLE IF NOT EXISTS T (A INTEGER PRIMARY KEY, B INTEGER, C VARCHAR, D INTEGER);
> -- create view
> CREATE VIEW IF NOT EXISTS V (VA INTEGER, VB INTEGER) AS SELECT * FROM T WHERE B=200;
> UPSERT INTO V(A,B,C,D,VA,VB) VALUES (2, 200, 'def', -20, 91, 101);
> ALTER VIEW V DROP COLUMN C;
> SELECT * FROM V;
> +----+------+------+-----+------+
> | A  |  B   |  D   | VA  |  VB  |
> +----+------+------+-----+------+
> | 2  | 200  | -20  | 91  | 101  |
> +----+------+------+-----+------+
> ALTER VIEW C ADD C VARCHAR;
> -- The above add column step throws an error. It used to work before 4.15.
> {code}
> The stack trace for the error thrown is:
> {code:java}
> Error: ERROR 1012 (42M03): Table undefined. tableName=C (state=42M03,code=1012)
> org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table undefined. tableName=C
> 	at org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:777)
> 	at org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:442)
> 	at org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:434)
> 	at org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:425)
> 	at org.apache.phoenix.compile.FromCompiler.getResolver(FromCompiler.java:277)
> 	at org.apache.phoenix.schema.MetaDataClient.addColumn(MetaDataClient.java:3627)
> 	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableAddColumnStatement$1.execute(PhoenixStatement.java:1488)
> 	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:415)
> 	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:397)
> 	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> 	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:396)
> 	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:384)
> 	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1886)
> 	at sqlline.Commands.execute(Commands.java:814)
> 	at sqlline.Commands.sql(Commands.java:754)
> 	at sqlline.SqlLine.dispatch(SqlLine.java:646)
> 	at sqlline.SqlLine.begin(SqlLine.java:510)
> 	at sqlline.SqlLine.start(SqlLine.java:233)
> 	at sqlline.SqlLine.main(SqlLine.java:175)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)