phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ankit Singhal <ankitsingha...@gmail.com>
Subject Re: Cannot select data from a system table
Date Sun, 21 Aug 2016 13:07:44 GMT
Aaron,

you can escape check for reserved keyword with double quotes ""

SELECT * FROM SYSTEM."FUNCTION"

Regards,
Ankit Singhal

On Fri, Aug 19, 2016 at 10:47 PM, Aaron Molitor <amolitor@splicemachine.com>
wrote:

> Looks like the SYSTEM.FUNCTION table is names with a reserved word. Is
> this a known bug?
>
>
> 0: jdbc:phoenix:stl-colo-srv073.splicemachine> !tables
> +------------+--------------+-------------+---------------+-
> ---------+------------+----------------------------+--------
> ---------+--------------+-----------------+---------------+-
> --------------+-----------------+------------+-----------+
> | TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |  TABLE_TYPE   | REMARKS  |
> TYPE_NAME  | SELF_REFERENCING_COL_NAME  | REF_GENERATION  | INDEX_STATE  |
> IMMUTABLE_ROWS  | SALT_BUCKETS  | MULTI_TENANT  | VIEW_STATEMENT  |
> VIEW_TYPE  | INDEX_TYP |
> +------------+--------------+-------------+---------------+-
> ---------+------------+----------------------------+--------
> ---------+--------------+-----------------+---------------+-
> --------------+-----------------+------------+-----------+
> |            | SYSTEM       | CATALOG     | SYSTEM TABLE  |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | SYSTEM       | FUNCTION    | SYSTEM TABLE  |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | SYSTEM       | SEQUENCE    | SYSTEM TABLE  |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | SYSTEM       | STATS       | SYSTEM TABLE  |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | TPCH         | CUSTOMER    | TABLE         |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | TPCH         | LINEITEM    | TABLE         |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | TPCH         | NATION      | TABLE         |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | TPCH         | ORDERS      | TABLE         |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | TPCH         | PART        | TABLE         |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | TPCH         | PARTSUPP    | TABLE         |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | TPCH         | REGION      | TABLE         |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> |            | TPCH         | SUPPLIER    | TABLE         |          |
>         |                            |                 |              |
> false           | null          | false         |                 |
>     |           |
> +------------+--------------+-------------+---------------+-
> ---------+------------+----------------------------+--------
> ---------+--------------+-----------------+---------------+-
> --------------+-----------------+------------+-----------+
> 0: jdbc:phoenix:stl-colo-srv073.splicemachine> select * from
> SYSTEM.FUNCTION;
> Error: ERROR 604 (42P00): Syntax error. Mismatched input. Expecting
> "NAME", got "FUNCTION" at line 1, column 22. (state=42P00,code=604)
> org.apache.phoenix.exception.PhoenixParserException: ERROR 604 (42P00):
> Syntax error. Mismatched input. Expecting "NAME", got "FUNCTION" at line 1,
> column 22.
>         at org.apache.phoenix.exception.PhoenixParserException.
> newException(PhoenixParserException.java:33)
>         at org.apache.phoenix.parse.SQLParser.parseStatement(
> SQLParser.java:111)
>         at org.apache.phoenix.jdbc.PhoenixStatement$
> PhoenixStatementParser.parseStatement(PhoenixStatement.java:1280)
>         at org.apache.phoenix.jdbc.PhoenixStatement.parseStatement(
> PhoenixStatement.java:1363)
>         at org.apache.phoenix.jdbc.PhoenixStatement.execute(
> PhoenixStatement.java:1434)
>         at sqlline.Commands.execute(Commands.java:822)
>         at sqlline.Commands.sql(Commands.java:732)
>         at sqlline.SqlLine.dispatch(SqlLine.java:807)
>         at sqlline.SqlLine.begin(SqlLine.java:681)
>         at sqlline.SqlLine.start(SqlLine.java:398)
>         at sqlline.SqlLine.main(SqlLine.java:292)
> Caused by: MismatchedTokenException(65!=99)
>         at org.apache.phoenix.parse.PhoenixSQLParser.
> recoverFromMismatchedToken(PhoenixSQLParser.java:360)
>         at org.apache.phoenix.shaded.org.antlr.runtime.BaseRecognizer.
> match(BaseRecognizer.java:115)
>         at org.apache.phoenix.parse.PhoenixSQLParser.parseNoReserved(
> PhoenixSQLParser.java:9969)
>         at org.apache.phoenix.parse.PhoenixSQLParser.identifier(
> PhoenixSQLParser.java:9936)
>         at org.apache.phoenix.parse.PhoenixSQLParser.from_table_
> name(PhoenixSQLParser.java:9589)
>         at org.apache.phoenix.parse.PhoenixSQLParser.table_factor(
> PhoenixSQLParser.java:6244)
>         at org.apache.phoenix.parse.PhoenixSQLParser.table_ref(
> PhoenixSQLParser.java:6066)
>         at org.apache.phoenix.parse.PhoenixSQLParser.table_list(
> PhoenixSQLParser.java:6002)
>         at org.apache.phoenix.parse.PhoenixSQLParser.parseFrom(
> PhoenixSQLParser.java:5967)
>         at org.apache.phoenix.parse.PhoenixSQLParser.single_
> select(PhoenixSQLParser.java:4595)
>         at org.apache.phoenix.parse.PhoenixSQLParser.unioned_
> selects(PhoenixSQLParser.java:4697)
>         at org.apache.phoenix.parse.PhoenixSQLParser.select_node(
> PhoenixSQLParser.java:4763)
>         at org.apache.phoenix.parse.PhoenixSQLParser.oneStatement(
> PhoenixSQLParser.java:789)
>         at org.apache.phoenix.parse.PhoenixSQLParser.statement(
> PhoenixSQLParser.java:508)
>         at org.apache.phoenix.parse.SQLParser.parseStatement(
> SQLParser.java:108)
>         ... 9 more

Mime
View raw message