Closed kwthoma closed 6 years ago
user
has become a keyword in CrateDB, so it has be quoted, the following should work:
CREATE TABLE guestbook.posts (
id STRING PRIMARY KEY,
"user" OBJECT(STRICT) AS (
name STRING,
location GEO_POINT
),
text STRING INDEX USING FULLTEXT WITH (analyzer = 'english'),
created TIMESTAMP,
image_ref STRING,
like_count LONG
) WITH (number_of_replicas = '0-2');
Thanks for reporting, we'll update the example.
Thanks for the quick response. Was able to create the table using the quotes.
We've also updated sql/schema.sql
(https://github.com/crate/crate-sample-apps/pull/69)
Get the following error when trying to create the tables for the sample app: SQLActionException[SQLParseException: line 3:5: no viable alternative at input 'user']
This is how it looks in the Crate admin tool, so I'm guessing "user" is a reserved word. Initially got the error when trying to load the schema via crash.
This is the portion of the code from sql/schema.sql that I pasted into the admin console: CREATE TABLE guestbook.posts ( id STRING PRIMARY KEY, USER OBJECT(STRICT) AS ( name STRING, location GEO_POINT ), text STRING INDEX USING FULLTEXT WITH (analyzer = 'english'), created TIMESTAMP, image_ref STRING, like_count LONG ) WITH (number_of_replicas = '0-2');