You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "jiahuili430 (via GitHub)" <gi...@apache.org> on 2023/03/09 15:20:08 UTC

[GitHub] [couchdb] jiahuili430 commented on a diff in pull request #4414: Mutual exclusive: key, keys, start_key and end_key

jiahuili430 commented on code in PR #4414:
URL: https://github.com/apache/couchdb/pull/4414#discussion_r1131175407


##########
src/couch_mrview/src/couch_mrview_http.erl:
##########
@@ -525,34 +530,147 @@ parse_param(Key, Val, Args, IsDecoded) ->
         "reduce" ->
             Args#mrargs{reduce = parse_boolean(Val)};
         "key" when IsDecoded ->
-            Args#mrargs{start_key = Val, end_key = Val};
+            case Args#mrargs.start_key =:= undefined andalso Args#mrargs.end_key =:= undefined of
+                true ->
+                    Args#mrargs{start_key = Val, end_key = Val};
+                _ ->
+                    throw(
+                        {query_parse_error,
+                            <<"`key(s)` is incompatible with `start_key` and `end_key`">>}
+                    )
+            end;

Review Comment:
   That's very clean, thanks for the advice!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org