edgedb / edgedb

A graph-relational database with declarative schema, built-in migration system, and a next-generation query language
https://edgedb.com
Apache License 2.0
13k stars 400 forks source link

Insert query fails silently after upgrading to 4.6 #7067

Closed lsdch closed 7 months ago

lsdch commented 7 months ago

Steps to Reproduce:

  1. Migrate the provided schema on an EdgeDB 4.6 instance
  2. Run query:
    select (insert people::Person {
    first_name:= "Test",
    last_name:= "TEST"
    }) { * }
    # Returns an empty set

    Running only the insert statement also return an empty set.
    Checking the database content confirms that the item was not inserted. Insertion of other object types seems to work, although I only tested a few of them.

Everything works as expected on v4.5.

Schema:

msullivan commented 7 months ago

Thanks for the report!

This issue is a knock-on effect of https://github.com/edgedb/edgedb/issues/7061.

Because the cardinality of the current_user global gets inferred incorrectly in queries, we perform some optimizations that are unsound when dealing with something of optional cardinality.

This will be fixed in 4.7 by reverting #6613 and in 5.x by https://github.com/edgedb/edgedb/pull/7062