You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by mi...@sina.cn on 2017/12/22 03:06:04 UTC
Does phoenix support creating table without primary key?
Hi,
I created a phoenix without specifying primary key, it returned me error.I am new to Phoenix, so I am asking can phoenix support creating table without pk? In business side, my data could be not unique.
0: jdbc:phoenix:esg08:2181> create table t_p(a integer, b varchar);Error: ERROR 509 (42888): The table does not have a primary key. tableName=T_P (state=42888,code=509)java.sql.SQLException: ERROR 509 (42888): The table does not have a primary key. tableName=T_P at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:396) at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145) at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:1810) at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:785) at org.apache.phoenix.compile.CreateTableCompiler$2.execute(CreateTableCompiler.java:186) at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:322) at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:314) at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:312) at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1435) at sqlline.Commands.execute(Commands.java:822) at sqlline.Commands.sql(Commands.java:732) at sqlline.SqlLine.dispatch(SqlLine.java:808) at sqlline.SqlLine.begin(SqlLine.java:681) at sqlline.SqlLine.start(SqlLine.java:398) at sqlline.SqlLine.main(SqlLine.java:292)
Re: Does phoenix support creating table without primary key?
Posted by Flavio Pompermaier <po...@okkam.it>.
I don't think you could define a table over hbase (that is a key-value
store) without a key...however it would be helpful in many use cases
On 22 Dec 2017 04:06, <mi...@sina.cn> wrote:
> Hi,
>
> I created a phoenix without specifying primary key, it returned me error.
> I am new to Phoenix, so I am asking can phoenix support creating table
> without pk? In business side, my data could be not unique.
>
>
> 0: jdbc:phoenix:esg08:2181> create table t_p(a integer, b varchar);
> Error: ERROR 509 (42888): The table does not have a primary key.
> tableName=T_P (state=42888,code=509)
> java.sql.SQLException: ERROR 509 (42888): The table does not have a
> primary key. tableName=T_P
> at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.
> newException(SQLExceptionCode.java:396)
> at org.apache.phoenix.exception.SQLExceptionInfo.buildException(
> SQLExceptionInfo.java:145)
> at org.apache.phoenix.schema.MetaDataClient.createTableInternal(
> MetaDataClient.java:1810)
> at org.apache.phoenix.schema.MetaDataClient.createTable(
> MetaDataClient.java:785)
> at org.apache.phoenix.compile.CreateTableCompiler$2.execute(
> CreateTableCompiler.java:186)
> at org.apache.phoenix.jdbc.PhoenixStatement$2.call(
> PhoenixStatement.java:322)
> at org.apache.phoenix.jdbc.PhoenixStatement$2.call(
> PhoenixStatement.java:314)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(
> PhoenixStatement.java:312)
> at org.apache.phoenix.jdbc.PhoenixStatement.execute(
> PhoenixStatement.java:1435)
> at sqlline.Commands.execute(Commands.java:822)
> at sqlline.Commands.sql(Commands.java:732)
> at sqlline.SqlLine.dispatch(SqlLine.java:808)
> at sqlline.SqlLine.begin(SqlLine.java:681)
> at sqlline.SqlLine.start(SqlLine.java:398)
> at sqlline.SqlLine.main(SqlLine.java:292)
>
>