cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Ballingall TF <balling...@thefoundry.co.uk>
Subject CQL3: Do boolean values need quoting in inserts?
Date Wed, 15 Aug 2012 09:06:45 GMT
Hi,

I was following the examples on this page:

http://www.datastax.com/dev/blog/whats-new-in-cql-3-0#comment-116250

In the example, a table was created as follows:

CREATE TABLE altercations (
       instigator text,
       started_at timestamp,
       ships_destroyed int,
       energy_used float,
       alliance_involvement boolean,
       PRIMARY KEY (instigator, started_at)
   );

The example then showed an insert into this table:

INSERT INTO altercations (instigator, started_at, ships_destroyed,
energy_used, alliance_involvement)
VALUES ('Jayne Cobb', '7943-07-23', 2, 4.6, false);

This threw the following error:

Bad Request: line 3:65 no viable alternative at input ‘false’

I managed to get it to work by single-quoting the boolean value. And
if I look at the data, it does indeed seem to have worked:

cqlsh:test> select * from altercations;
instigator | started_at | alliance_involvement | energy_used | ships_destroyed
————+————————–+———————-+————-+—————–
Jayne Cobb | 7943-07-23 00:00:00+0000 | False | 4.6 | 2


I was using cqlsh -3 ( cqlsh 2.2.0 | Cassandra 1.1.2 | CQL spec 3.0.0
| Thrift protocol 19.32.0)

Is this a bug, or must we quote booleans in CQL?

Thanks
Andy

-- 
Andy Ballingall
Senior Software Engineer

The Foundry
6th Floor, The Communications Building,
48, Leicester Square,
London, WC2H 7LT, UK
Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906
Web: http://www.thefoundry.co.uk/

The Foundry Visionmongers Ltd.
Registered in England and Wales No: 4642027

Mime
View raw message