phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Dimiduk <ndimi...@gmail.com>
Subject Empty VARCHAR columns in primary keys
Date Tue, 12 Jan 2016 20:24:43 GMT
Hi there,

I have a question about 0-length VARCHAR columns used in primary keys.
Specifically, I have a schema like,

> CREATE TABLE test (foo INTEGER NOT NULL, bar VARCHAR NOT NULL, CONSTRAINT
pk PRIMARY KEY (foo, bar)) SALT_BUCKETS=1;

My understanding is that the compount rowkey for this table is 1-byte (salt
bucket), 4-bytes (foo), ... (bar).

Inserting a row with '' for bar throws a constraint violation

> UPSERT INTO test VALUES(0, '');
Error: ERROR 218 (22018): Constraint violation. TEST.BAR may not be null
(state=22018,code=218)

In the above statement, TEST.BAR is not null. I expected that Phoenix would
treat any rowkey content after the first 5 bytes as the value for the bar
column. Further, I expected that Phoenix could infer any rowkey of length 5
as having the value '' for bar because the NOT NULL predicate is provided
on on the column definition.

Might someone shed some light on the issue at hand? Am I doing something
dumb?

Thanks,
Nick

Mime
View raw message