Ask AI

EdgeDB v2 (Sagittarius)

EdgeDB 2.0 was released on July 28th, 2022. Read the announcement blog post here.

We would like to thank our community for reporting issues and contributing fixes. You are awesome! ❤️

To play with the new features, install the CLI and initialize a new project. For an interesting schema with test data, check out the MCU Sandbox repo.

edgedb project init

Local instances

To upgrade a local project, run the following command inside the project directory.

edgedb project upgrade --to-latest

Alternatively, specify an instance name if you aren’t using a project.

edgedb project upgrade --to-latest -I my_instance

Hosted instances

To upgrade a remote (hosted) instance, we recommend the following dump-and-restore process.

1. Spin up an empty 2.0 instance by following one of our deployment guides. These guides have been updated to 2.0. Keep the DSN of the newly created instance handy.

  1. Take your application offline, then dump your v1.x database with the CLI

    edgedb dump --dsn <old dsn> --all my_database.dump/

    This will dump the schema and contents of your current database to a file on your local disk called my_database.dump. The file name isn’t important.

  2. Restore the empty v2.x instance from the dump

    edgedb restore --all my_database.dump/ --dsn <new dsn>

    Once the restore is complete, update your application to connect to the new instance.

If your Postgres cluster is also backing other versions of EdgeDB, make sure you start your new instance with the --ignore-other-tenants option when bootstrapping your new instance.

This process will involve some downtime, specifically during steps 2 and 3. We are working on an in-place upgrade workflow that will reduce the amount of downtime involved and avoid the need to spin up a new instance. We’ll publish that soon; join the Discord for updates. Though for most applications the dump-and-restore workflow will be simpler and less error-prone.

We’ve released new versions of our JavaScript and Python client libraries that support all 2.0 features and implement the updated protocol. These versions are backwards compatible with v1.x instances, so we encourage all users to upgrade.









.NET (community-maintained)


Elixir (community-maintained)


All v2 instances ship with a built-in rich admin GUI. Access it by running edgedb ui inside any EdgeDB project, or specify a local instance name with edgedb ui -I my_inst. The command opens the instance’s admin UI using the default system browser.

The current iteration of the GUI has

  • a data browser and editor

  • a REPL for writing and executing EdgeQL queries

  • a schema introspection tool with text-based and graphical visualizations of the instance’s current schema

The new GROUP expression can be used to partition and aggregate data. The output of GROUP are free objects representing each group, including the grouping, the grouping key, and the set of elements.

group Movie { title } by .release_year;
    key: {release_year: 2017},
    grouping: {'release_year'},
    elements: {
      default::Movie {title: 'Guardians of the Galaxy Vol. 2'},
      default::Movie {title: 'Spider-Man: Homecoming'},
      default::Movie {title: 'Thor: Ragnarok'},
    key: {release_year: 2013},
    grouping: {'release_year'},
    elements: {
      default::Movie {title: 'Iron Man 3'},
      default::Movie {title: 'Thor: The Dark World'},

Browse the docs for more details and examples, or refer to the original RFC 1009.

Your schema can now contain global variables. These are contextual variables that are provided by the client and can be referenced in your queries and schema.

global current_user -> uuid;
select User filter .id = global current_user;

Client libraries have been updated to provide method for attaching global variables to a Client instance; these values are sent along with all queries originating from that Client.

import {createClient} from 'edgedb';

const client = createClient().withGlobals({
  current_user: '2141a5b4-5634-4ccc-b835-437863534c51',

await client.query(`select global current_user;`);
from edgedb import create_client

client = create_client().with_globals({
    'current_user': '580cc652-8ab8-4a20-8db9-4c79a4b1fd81'

result = client.query("""
    select global current_user;
package main

import (


func main() {
  ctx := context.Background()
  client, err := edgedb.CreateClient(ctx, edgedb.Options{})
  if err != nil {
  defer client.Close()

  id, err := edgedb.ParseUUID("2141a5b4-5634-4ccc-b835-437863534c51")
  if err != nil {

  var result edgedb.UUID
  err = client.
    WithGlobals(map[string]interface{}{"current_user": id}).
    QuerySingle(ctx, "SELECT global current_user;", &result)
  if err != nil {


Globals are primarily intended as an enabling mechanism for object-level security.

Object types can now be augmented with object-level access policies. When combined with global variables, access policies can be used to push authorization logic into the database.

global current_user -> uuid;

type User {
  required property email -> str { constraint exclusive; };

type BlogPost {
  required property title -> str;
  link author -> User;
  access policy own_posts allow all using ( ?= global current_user

Refer to the docs or RFC 1011 for full details.

EdgeDB now supports range types representing intervals of values.

select range(1, 10);
{range(1, 10, inc_lower := true, inc_upper := false)}
select range_unpack(range(1, 10))
{1, 2, 3, 4, 5, 6, 7, 8, 9}

This release also introduces a new datatype cal::date_duration to represent a span of months/days. It is nearly equivalent to the existing cal::relative_duration but cannot represent sub-day durations.

This type is primarily intended to simplify cal::local_date logic.

db> select <cal::local_date>'2022-06-25' +
...   <cal::date_duration>'5 days';
db> select <cal::local_date>'2022-06-30' -
...   <cal::local_date>'2022-06-25';

Add deletion cascade functionality with on source delete.

type BlogPost {
  property title -> str;

type Person {
  multi link posts -> BlogPost {
    on source delete delete target;

Under this policy, deleting a User will unconditionally delete its posts as well.

To avoid deleting a Post that is linked to by other schema entities, append if orphan.

type Person {
  multi link posts -> BlogPost {
    on source delete delete target;
    on source delete delete target if orphan;
  • Support socket activation to reduce memory footprint on developer machines (#3899).

  • Introduce edgedb+http, a which tunnels the binary protocol over HTTP using JWT for authentication (#3979).

  • Support using JWT to authenticate to local instances (#3991).

  • Generate unique id fields for each free shape object, and don’t use an actual in-database object to represent it, and make multiplicity inference understand free shapes better (#3631, #3633, #3634).

  • Fail if local Postgres cluster fails to start.

  • Add cfg::memory to base types descriptor IDs table (#3882).

  • Fix a cross-type exclusive constraint bug that could allow exclusive constraints to be violated in some complex type hierarchies (#3887).

  • Fix issue where server might attempt to acquire one more connection than it is configured to permit (#3901).

  • Fix use of assert_exists on properties that are being directly output (#3911).

  • Fix a scope leakage that could cause a link referenced inside a computable to improperly correlate with something outside the computable (#3912).

  • Fix a number of issues with the floordiv (//) and modulus (%) operators where we could return incorrect values or produce spurious errors, especially on very large values (#3909).

  • Allow adding annotations to abstract annotation definitions (#3929).

  • Expose body and language fields on schema::Function (#3944).

  • Make indexes extend from schema::InheritingObject (#3942).

  • Fix some mis-compilations of nested shapes inside calls to functions like assert_single (#3927).

  • Fix SET TYPE on properties with default values (#3954).

  • Fix describe/populate/describe sequence (#3959).

  • Upgrade many casts and functions from “Stable” to “Immutable” (#3975).

  • Fix link properties in type filtered shape links (#3987).

  • Allow DML statements in free shapes (#4002).

  • Allow customizing assertion messages in assert_exists and friends (#4019).

  • A new version of the protocol—version 1.0—has been introduced. It eliminates all server state associated with connections that do not use transactions.

  • Support passing parameters to and returning values from multi-statement scripts.

  • Fix global defaults with nontrivial computation (#4182)

  • Fix migration that removes policy using clause (#4183)

  • Support ELSE-less UNLESS CONFLICT on explicit id INSERT (#4185)

  • Don’t create constraints on derived views when adding a pointer to a type (#4187)

  • Fix a bunch of missing source contexts in declarative (#4188)

  • Fix an ISE when a computed link is directly a property reference (#4193)

  • Fix an ISE when using an empty shape in some contexts (#4194)

  • Fix a number of error messages involving collection types in schemas (#4195)

  • Avoid doing semi-joins after a sequence of single links (#4196)

  • Make range() properly strict in its non-optional arguments (#4207)

  • Allow multiple FDs per socket in activation (#4189)

  • Add SCRAM authentication over HTTP (#4197)

  • Always arm auto-shutdown timer when it’s greater than zero (#4214)

  • Fix json -> array<json> cast of ‘[]’ (#4217)

  • Support UNLESS CONFLICT ON for pointers with DML in them (#4357)

  • Fix cardinality in CommandDataDescription (#4347)

  • Prevent access rule hidden ids from leaking when accessed directly (#4339)

  • Better messages for required links hidden by policies (#4338)

  • Fix access policies on DELETE of a UNION type (#4337)

  • Strip out all views from DML subjects when computing what tables to use (#4336, #4333)

  • Fix interaction between access policies and omitted fields in insert (#4332, #4219)

  • Fix a tracer issue with reverse links and IS (#4331)

  • Don’t include union types in link triggers (#4329, #4320)

    If you encounter this issue, after upgrading to a version with this patch, it can be fixed by doing a dump/restore or by adding a new link to the affected type.

  • Require ON for constraints on objects (#4324, #4268)

  • Fix interaction between DETACHED and aliases/globals (#4321, #4258)

  • Disable access policy rewrite when compiling constraints (#4248, #4245)

  • Expose --admin-ui as an environment variable and document it (#4255)

  • Prevent HttpProtocol.close from crashing on closed client connection (#4238)

  • Fix permitted JSON null in nested array cast (#4221)

  • Fix range_unpack boundary bug.

    The range_unpack function was incorrectly excluding values close to boundary, especially when the boundary was not itself inclusive. (#4282)

  • UI: Allow selection of read-only properties in data editor (edgedb/edgedb-ui/#65)

  • UI: Hide subtype columns in data editor by default; add a toggle to show them. (edgedb/edgedb-ui/#43)

  • UI: Add “create example database” to the database selection screen. (edgedb/edgedb-ui/#61)

  • UI: Fix navigation from being reset on switching the UI panes. (edgedb/edgedb-ui/#61)

  • UI: Fix rendering of range types. (edgedb/edgedb-ui/#61)

  • UI: Fix the data editor UI to render types that have some properties or links masked by an access policy. (edgedb/edgedb-ui/#61)

  • UI: Implement login page for remote instances. (edgedb/edgedb-ui/#40)

  • Clarify error message when UI is not enabled (#4256)

  • Fix an issue with inherited computeds (#4371)

  • Fix bug in diamond pattern constraint inheritance (#4379)

  • When finding common parent for arrays, never use expr alias arrays (#4080)

  • Properly quote numeric names when in codegen (#4344)

  • Fix computed global scoping behavior (#4388)

  • Fix DDL performance issues on databases with lots of data (#4401)

  • Fix potentially missed constraints on DML (#4410)

  • Fix slicing with an empty set (#4404)

  • Fix slicing array of tuples (#4391)

  • Don’t apply access policies when compiling indexes (#4420)

  • Fix slicing of tuple arrays with null inputs (#4421)

  • Propagate database creation and deletion events to adjacent servers (#4415)

  • Fix database initialization on hosted environments like Heroku. (#4432)

  • Prevent spurious errors when using backlinks on types that have properties with the same name but different types (#4443)

  • Fix some spurious errors when removing a link from the schema. (#4451)

  • For query_single, only check that the last query in a script is single. (#4453)

  • Catch when POPULATE MIGRATION generates incorrect DDL. This should prevent bugs where the schema can get into wedged states. (#4484)

  • workflows: Publish multiarch Docker images (#4486)

  • Make unused param insertion in the sql compiler more reliable (#4497)

  • Properly propagate creation and deletion of extensions

  • Fix potential exclusive constraint violations when doing an UPDATE on a union (#4507)

  • Don’t lose type from inheritance views when rebasing (#4509)

  • Make object type descriptor ids be derived from type name (#4503)

  • Check for invalid arrays arguments at the protocol level (#4511)

  • Fix SET REQUIRED on newly created properties with alias subtypes (#4513)

  • Make newly created link properties get added to the relevant alias types (#4512)

  • Fix handling of link properties named id (#4514)

  • Disallow queries using conflict machinery on a link property. This prevents certain potential exclusive constraint violations that were not handled correctly. (#4515)

  • Fix performing multiple deletions at once in the UI (#4523)

  • Fix casting empty sets to built in enum types (#4532)

  • Produce better error messages when using enum incorrectly (#4527)

  • Make '\b' produce the correct value in string and bytes literals (#4535)

  • Properly infer cardinality of empty array as ONE (#4533)

  • Fix several issues that manifest when using GROUP BY (#4549, #4439)

  • Fix migration scripts when combined with access policies (#4553)

  • Fix failure when a ALTER ... EXTENDING doesn’t change the set of ancestors (#4554)

  • Fix UNLESS CONFLICT ON for a not-inserted property (#4556)

  • Fix access policies that use shapes internally (#4555)

  • Allow overloading __type__ with a computed in shapes (#4557)

Starting with EdgeDB 3.0, access policy restrictions will not be applied while evaluating other access policy expressions (#4574).

It is possible (and recommended) to enable this future behavior in EdgeDB 2.6 by adding the following to the schema: using future nonrecursive_access_policies;

For more details, see the docs.

To enable opting in to this behavior, 2.6 adds a general mechanism to opt into future behavior changes (#4574, #4606).

  • Fix passing zero dimensional array as arguments. This was a regression introduced in 2.4, and affected passing empty arrays from the the Rust bindings. (#4511)

  • Require that constraint expressions be immutable (#4593)

  • Only permit valid UUID-generation functions to be made the default value for id (#4616)

  • UI: New mechanism for copying data in REPL and in Data Editor. Hover over a data line and click the context “COPY” button.

  • UI: “Disable Access Policies” and “Persist Query” options in REPL remember their state between page refreshes.

  • UI: Basic autocomplete now works for INSERT, UPDATE, and DELETE queries.

  • Improve error messages when compiling pointer default (#4624)

  • Fix using WITH-bound DML from an UPDATE in an ELSE clause (#4641)

  • Allow WITH MODULE in ddl in CREATE MIGRATION (#4668)

  • Fix some broken casts from object types to JSON (#4663)

  • Fix putting a statement as the body of an access policy (#4667)

  • Loosen the rules on when we produce a “would change the interpretation” error. It is not only produced when a link is being used, not a property. (#4643)

  • Fix certain errors involving default values in access policies (#4679)

  • Avoid ISE when pickling DynamicRangeVar (#4681)

  • Fix max_ex_value constraint. (#4671)

  • Fix SET GLOBAL capabilities to no longer break in the CLI. (#4688)

  • Fix links to schema::ObjectType breaking DROP TYPE. If you have a link in your schema to schema::ObjectType or one of its ancestors and you encounter internal server errors when trying to drop a type, it should be possible to repair your database by creating and then deleting a new link to schema::ObjectType. (#4670)

  • Don’t insert unnecessary assert_exists calls on required links inside access policies bodies in some cases. (#4695)

  • Fix DML access policies that use shapes internally (#4589)

  • Give a proper error message creating a migration with a USING that has DML (#4707)

  • Don’t incorrectly evaluate DML access policies when elements are also DML. This fixes some cases in which policies would pass incorrectly. (#4745)

  • Fix direct use of __subject__ from insert access policies (#4752)

  • Produce an error message on casts to and literal references of enum types from indexes and constraints. Currently we generate an internal server error. A real fix unfortunately must wait for 3.0 for technical reasons. (#4754)

  • Only apply filter cardinality inference to unique sets (#4763)

  • Fix changing a link to non-computed and single at the same time (#4764)

  • Fix error message for function calls on derived types (#4757)

  • Fix deleting certain complex aliases (#4777)

  • Fix link properties on inherited backlinks (#4788)

  • Fix using array/string/bytes/json subscripting inside of indexes and constraints. (#4760)

  • Fix apparent startup hangs due to a lock fd leaking into postgres (#4797)

  • Fix some migrations with tricky constraint/computed interactions (#4794)

  • Fix broken DROPs of pointers in some multiple-inheritance situations (#4809)

  • Properly execute function calls in UPDATE once per object (#4810)

  • Fix accessing tuple elements on link properties (#4811)

  • Fix assert_exists() not firing on some tuple values (#4812)

  • Fix GROUP on the result of enumerate (#4813)

  • Support more env vars in, standardize docs (#4387)

  • Fix computed properties that just copy id (#4807)

  • Fix backlinks on derived union types (#4818)

  • Fix references to the enclosing type in schema-defined computeds (#4826)

  • UI: Fix regression introduced in 2.8 when editing empty string fields in data explorer

  • UI: Improvements to handling of union link targets in schema and data explorer views

  • UI: Fix loading indicators on tabs

  • Fix mismatch in session state after a ROLLBACK

  • Fix ISE when doing set default on an abstract pointer (#4843)

  • Fix accesses to __type__ from insert access policies (#4865)

  • Properly forbid aggregation in index expressions (#4869)

  • Fix grouping field when grouping by one key or nothing (#4906)

  • Fix two issues with mutation in free objects (#4902)

  • Only allow type names as the subject of an insert. (Previously dotted paths were allowed, with nonsensical behavior.) (#4922)

  • Fix array arguments in HTTP interface (#4956)

  • Support multi properties in UNLESS CONFLICT ON (#4955)

  • Fix polymorphic type tests on result of update (#4954)

  • Optimize trivial WITH -bound GROUP uses (#4978)

  • Fix a category of confusing scoping related bugs in access policies (#4994)

  • Get rid of the “unused alias definition” error. (#4819)

  • Support mutation in USING expressions when changing a link to required or to single during a migration (#4873)

  • Fix custom function calls on the HTTP interface (#4998)

  • Avoid infinite recursion in some do-nothing intersection cases (#5007)

  • Don’t mangle cast error messages when the cast value contains a type name (#5008)

  • Allow JWT token auth in binary protocol (#4830)

  • Use prepared statement cache in EdgeQL script execution (#4931)

  • Fix non-transactional commands like DROP DATABASE when using Postgres 14.7 (#5026)

  • Update packaged Postgres to 14.7

  • Fix set single on required properties (#5031)

  • Fix a ISE when using assert_exists and linkprops using query builder (#4961)

  • Fix adding a link property with a default value to an existing link (a regression in 2.10) (#5061)

  • Fix GROUP regression with some query-builder queries (a regression in 2.10) (#5073)

  • Implement a MIGRATION REWRITE system. This provides a mechanism for safely rewriting the migration history of a database while ensuring that the new history produces the same result as the old history. CLI tooling to take advantage of this feature is coming soon. (#4585)

  • Fix DigitalOcean support: allow its custom error in bootstrap (#5139)

  • Add a hint to the error message about link targets. (#5131)

  • Infer cardinality of required multi pointers as AT_LEAST_ONE (#5180)

  • Fix dump/restore of migrations with messages on them (#5171)

  • Fix interaction of link properties and assert_exists and similar (#5182)

  • Make assert_single and similar not lose track of values updated in an UPDATE in their argument. (#5088)

  • Add a test for assert_exists+assert_single+UPDATE (#5242)

  • Add support for new JWT layout (#5197)

  • Fix uses of volatile expressions in update write access policies (#5256)

  • Allow globals to be used in defaults (#5268)

  • Fix errmessage interpolation to not produce an internal server error on braces in a message. Allow {{ and }} to be used to escape braces. (#5295)

Previously, certain bug fixes and changes (such as the fix to cardinality inferenced of required multi pointers released in 2.13 (#5180)), could cause schemas to enter an inconsistent state from which many migrations were not possible.

The cause of this problem is that an incorrectly inferred value (such as the cardinality of a computed property) may have been computed and stored in a previous version. When a newer version is used, there will be a mismatch between the correctly inferred value on the new version, and the incorrectly stored value in the database’s schema.

The most straightforward way to fix such problems was to perform a dump and then a restore.

To fix this, we have introduced a schema repair mechanism that will run when upgrading a database to 2.14. This repair mechanism will fix any incorrectly inferred fields that are stored in the schema.

One particular hazard in this, however, is that the repair is not easily reversible if you need to downgrade to an earlier version. We recommend performing a dump before upgrading to 2.14.

These changes were made in (#5337); more discussion of the issue can be found in (#5321).

  • Correctly display constraint errors on id (#5344)

  • Fix adding certain computed links to a type with an alias (#5329)

  • In multi-server instances, properly reload schema after a restore (#5463)

  • Fix several bugs synchronizing configuration state

  • Fix dropping a pointer’s constraint and making it computed at the same time (#5411)

  • Don’t claim that making a pointer computed is data-safe (#5412)

  • Prohibit NUL character in query source (#5414)

  • Fix migration that delete an link alias computed in a parent and child (#5428)

  • Fix GraphQL updates for multi links. (#4260)

  • Fix altering enum that is used in a tuple (#5445)

  • Fix changing cardinality of properties on types used in unions (#5457)

  • Enable GraphQL support for type unions.

  • Fix making pointer non-computed and giving it an abstract base at the same time (#5458)

  • Make json casts of object arrays not include extra fields (#5484)

  • Make coalesce infer a union type (#5472)

  • Fix ISEs involving single link with only computed link properties (#5499)

  • Don’t ISE on free shape in insert (#5438)

  • Always set cardinality of derived __tname__ properties (#5508)

  • Work around mysterious postgres crashes on Digital Ocean (#5505)

  • Make reestablishing system postgres connections more resilient (#5511)

  • Fix graphql queries made against a freshly started server (#5456)

  • Support dumping databases with std::duration config vals (#5528)

  • Fix ISE for TypeExprs in function returns (#5540)

  • Support comparisons on durations in static eval

  • Fix create database conflicts with name in schema (#5515)

  • Fix range and bytes output in json-lines/json-pretty mode (#5572)

  • Include source locations in more scoping error messages (#5573)

  • Fix an optional scoping bug with important access policy implications (#5575)