You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Nolan Lawson (JIRA)" <ji...@apache.org> on 2014/04/17 07:47:15 UTC

[jira] [Updated] (COUCHDB-2226) Wrongful query_parse_error on group_level=999, keys.length > 1

     [ https://issues.apache.org/jira/browse/COUCHDB-2226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nolan Lawson updated COUCHDB-2226:
----------------------------------

    Description: 
It's expected that {{group=true}} will avoid the query parse error if keys.length > 1, but since {{group_level=999}} is semantically equivalent to {{group=true}}, one would expect that it would also avoid the error.  However, it doesn't.

Tested against CouchDB 1.5.0.  The script below will repro the error.

{code}
DB=http://localhost:5984/mytestdb
curl -X DELETE $DB
curl -X PUT $DB
curl -X PUT $DB/_design/ddoc -H 'content-type:application/json' -d '{"views" : {"view" : {"map" : "function (doc){emit(doc._id);}", "reduce" : "_count"}}}'
curl -X POST $DB/_bulk_docs -H 'content-type:application/json' -d '{"docs" : [{"_id" : "1"}, {"_id" : "2"}]}'

# returns 2 results
curl -g "$DB/_design/ddoc/_view/view?group=true&keys=[%221%22,%222%22]"

# throws a query_parse_error
curl -g "$DB/_design/ddoc/_view/view?group_level=999&keys=[%221%22,%222%22]"
{code}

  was:
It's expected that `group=true` will avoid the query parse error if keys.length > 1, but since `group_level=999` is semantically equivalent to `group=true`, one would expect that it would also avoid the error.  However, it doesn't.

Tested against CouchDB 1.5.0.  The script below will repro the error.

{code}
DB=http://localhost:5984/mytestdb
curl -X DELETE $DB
curl -X PUT $DB
curl -X PUT $DB/_design/ddoc -H 'content-type:application/json' -d '{"views" : {"view" : {"map" : "function (doc){emit(doc._id);}", "reduce" : "_count"}}}'
curl -X POST $DB/_bulk_docs -H 'content-type:application/json' -d '{"docs" : [{"_id" : "1"}, {"_id" : "2"}]}'

# returns 2 results
curl -g "$DB/_design/ddoc/_view/view?group=true&keys=[%221%22,%222%22]"

# throws a query_parse_error
curl -g "$DB/_design/ddoc/_view/view?group_level=999&keys=[%221%22,%222%22]"
{code}


> Wrongful query_parse_error on group_level=999, keys.length > 1
> --------------------------------------------------------------
>
>                 Key: COUCHDB-2226
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2226
>             Project: CouchDB
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>            Reporter: Nolan Lawson
>
> It's expected that {{group=true}} will avoid the query parse error if keys.length > 1, but since {{group_level=999}} is semantically equivalent to {{group=true}}, one would expect that it would also avoid the error.  However, it doesn't.
> Tested against CouchDB 1.5.0.  The script below will repro the error.
> {code}
> DB=http://localhost:5984/mytestdb
> curl -X DELETE $DB
> curl -X PUT $DB
> curl -X PUT $DB/_design/ddoc -H 'content-type:application/json' -d '{"views" : {"view" : {"map" : "function (doc){emit(doc._id);}", "reduce" : "_count"}}}'
> curl -X POST $DB/_bulk_docs -H 'content-type:application/json' -d '{"docs" : [{"_id" : "1"}, {"_id" : "2"}]}'
> # returns 2 results
> curl -g "$DB/_design/ddoc/_view/view?group=true&keys=[%221%22,%222%22]"
> # throws a query_parse_error
> curl -g "$DB/_design/ddoc/_view/view?group_level=999&keys=[%221%22,%222%22]"
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)