edgedb / edgedb-python

The official Python client library for EdgeDB
https://edgedb.com
Apache License 2.0
366 stars 43 forks source link

edgedb-py reports a computed field error, when actually it's a duplicate #492

Open jimkring opened 1 month ago

jimkring commented 1 month ago

Describe the bug I had a duplicate field in a query:

update PackageVersion
filter .id = <uuid>$id
set {
    pkg := <optional Package><optional uuid>$package_id ?? .pkg,
    display_name := <optional str>$display_name ?? .display_name,
    version_string := <optional str>$version_string ?? .version_string,
    icon := <optional Image><optional uuid>$icon_id ?? .icon,
    display_name := <optional str>$display_name ?? .display_name,
    description := <optional str>$description ?? .description,
};

when I run edgedb-py I get the following error message:

File "edgedb\protocol\protocol.pyx", line 322, in _parse
edgedb.errors.QueryError: modification of computed property 'display_name' of object type 'default::PackageVersion' is prohibited
   ┌─ query:8:5
   │ 
 8 │       display_name := <optional str>$display_name ?? .display_name,
   │       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error

Expected behavior I would hope to have an error indicating that the query is trying to SET the same field twice, the name of the field, and the line that's setting it for the second time.

Versions (please complete the following information):

Additional context Thanks for your great work on edgedb!