kaplievabell
kaplievabell

Reputation: 811

Does couchbase analytics support all N1QL commands?

Does Couchbase Analitics supports all N1QL language features? I using workbench to test 2 queries in Query tab and Analytics tab. Query tab executes queries, while in Analytics tab I am getting errors "Syntax error".

Queries:

1. select * FROM [1, 2, 3, 4, 5] as res OFFSET 2

2. select [1, 2, 3, 4, 5][1:3] as res;

Upvotes: 3

Views: 87

Answers (2)

tillw
tillw

Reputation: 66

The array slicing syntax is currently not supported in Couchbase Analytics. To get the same result today you can use a subquery instead

SELECT (SELECT VALUE v FROM [1, 2, 3, 4, 5] v LIMIT 2 OFFSET 1) as res

Upvotes: 3

Matthew Groves
Matthew Groves

Reputation: 26141

As of today, SQL++ (aka N1QL for Analytics) and N1QL (aka N1QL for Query) are two different languages.

For your first query, OFFSET is not (yet) supported in Analytics without a LIMIT.

For the second query, it's looks like you're trying to do something similar to offset/limit, but it looks like the : part is not supported in Analytics. I'm not exactly sure if there's an equivalent. You might want to have a peek at the docs page N1QL for Analytics vs. N1QL for Query.

Upvotes: 1

Related Questions