0
votes

I am very new to Apache Phoenix. I have created table using query in SQuirrel SQL client. Here I shared the sample query below.

CREATE TABLE IF NOT EXISTS Sample(Action VARCHAR NOT NULL, Title VARCHAR, Email VARCHAR, Type VARCHAR CONSTRAINT PKforum PRIMARY KEY (Action));

Title column has the value which maximum size is 200 characters.

Then I tried to fetch data from Apache Phoenix using Simba Pheonix ODBC driver. For this, used the below C# code..

OdbcConnection connection = new OdbcConnection("Driver={Simba Phoenix ODBC Driver};host=<host name>;port=8765");
        connection.Open();
        OdbcCommand command = new OdbcCommand(query,connection);
        OdbcDataReader dataReader = command.ExecuteReader();
        DataTable dataTable = new DataTable();
        dataTable.Load(dataReader);
        connection.Close();

When loading data table I got the below exception.

failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

If I change my query like below its working fine.

CREATE TABLE IF NOT EXISTS Sample(Action VARCHAR NOT NULL, Title VARCHAR(300), Email VARCHAR, Type VARCHAR CONSTRAINT PKforum PRIMARY KEY (Action));

Here my doubt is, What is the default size and maximum size of VARCHAR in Phoenix server?

1

1 Answers

0
votes

Range will be the type of int as mentioned below ..

https://phoenix.apache.org/language/index.html#int