Is it possible to use fields on the UDT as primary / cluster keys?

On Tue, Oct 11, 2016 at 9:49 AM, Ali Akhtar <ali.rac...@gmail.com> wrote:

> Yeah, you're right, it does work if I run it thru cqlsh. I was using
> DevCenter which shows that error.
>
> On Tue, Oct 11, 2016 at 9:48 AM, Andrew Tolbert <
> andrew.tolb...@datastax.com> wrote:
>
>> That works for me.   Are you sure you are on 3.6+?  What error message
>> are you getting?
>>
>> Thanks,
>> Andy
>>
>> On Mon, Oct 10, 2016 at 11:25 PM Ali Akhtar <ali.rac...@gmail.com> wrote:
>>
>>> CREATE TYPE test (
>>> foo text,
>>> bar text
>>> );
>>>
>>> CREATE TABLE test_table (
>>> id text,
>>> this_doesnt_work test,
>>> PRIMARY KEY (id)
>>> );
>>>
>>> On Tue, Oct 11, 2016 at 9:23 AM, Andrew Tolbert <
>>> andrew.tolb...@datastax.com> wrote:
>>>
>>> Can you please share an example where it doesn't work?
>>>
>>> Thanks,
>>> Andy
>>>
>>> On Mon, Oct 10, 2016 at 11:21 PM Ali Akhtar <ali.rac...@gmail.com>
>>> wrote:
>>>
>>> Not sure I understand the question, sorry.
>>>
>>> The column isn't part of the primary key.
>>>
>>> I defined a UDT and then I tried to define a column (not primary or
>>> cluster key) as being of that type, but it doesn't let me do that unless i
>>> set it as frozen. Docs indicate otherwise though
>>>
>>> On Tue, Oct 11, 2016 at 9:09 AM, Andrew Tolbert <
>>> andrew.tolb...@datastax.com> wrote:
>>>
>>> Is the column you are using that has the UDT type is the or is part of
>>> the primary key?  If that is the case it still needs to be frozen (the same
>>> goes for list, set, tuple as part of primary key).  This is the error I get
>>> when I try that:
>>>
>>> InvalidRequest: Error from server: code=2200 [Invalid query]
>>> message="Invalid non-frozen user-defined type for PRIMARY KEY component
>>> basics"
>>>
>>> Andy
>>>
>>> On Mon, Oct 10, 2016 at 8:27 PM Ali Akhtar <ali.rac...@gmail.com> wrote:
>>>
>>> According to http://docs.datastax.com/en/cql/3.3/cql/cql_using/useCrea
>>> teUDT.html
>>>
>>> >  In Cassandra 3.6 and later, the frozen keyword is not required for
>>> UDTs that contain only non-collection fields.
>>>
>>> However if I create a type with 4-5 all text fields, and try to use that
>>> type in another table, I get told to use frozen , even though I'm on
>>> cassandra 3.9
>>>
>>> >  show VERSION
>>> > [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4]
>>>
>>> Any ideas?
>>>
>>>
>>>
>>>
>

Reply via email to