Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnsupportedFeatureError: set returning functions are not supported in simple expressions #4342

Closed
andrephilipsson opened this issue Sep 11, 2022 · 1 comment

Comments

@andrephilipsson
Copy link

  • EdgeDB Version: 2.1
  • OS Version: macOS 12.5.1

Steps to Reproduce:

  1. Running edgedb migration create && edgedb migrate from this schema:
module default {
  global current_user -> uuid;

  type User {
    access policy limit_to_current_user
      allow all
      using (global current_user ?= .id);
  }

  type LoginCode {
    required property code -> str;

    required link user -> User;

    constraint exclusive on ((.user, .code));

    access policy limit_to_current_user
      allow all
      using (global current_user ?= .user.id);
  }
}

results in:

Created dbschema/migrations/00001.edgeql, id: m1uhrnii6aymztxa73vr5bnnrf7cjatxdcd5oouqpk72elj6p6i3wq
edgedb error: UnsupportedFeatureError: set returning functions are not supported in simple expressions
  1. Remove the access policy from the User type:
 module default {
   global current_user -> uuid;
 
-  type User {
-    access policy limit_to_current_user
-      allow all
-      using (global current_user ?= .id);
-  }
+  type User {}
 
   type LoginCode {
     required property code -> str;

If we remove the unsuccessful migration with rm dbschema/migrations/00001.edgeql and then run edgedb migration create && edgedb migrate again, the result is:

Created dbschema/migrations/00001.edgeql, id: m1pebzmkoklhrqjubkqydozbxsivsdtkvz2o4arxpdeivm45pderba
Applied m1pebzmkoklhrqjubkqydozbxsivsdtkvz2o4arxpdeivm45pderba (00001.edgeql)
  1. If we then add back the access policy to the User type:
 module default {
   global current_user -> uuid;
 
-  type User {}
+  type User {
+    access policy limit_to_current_user
+      allow all
+      using (global current_user ?= .id);
+  }
 
   type LoginCode {
     required property code -> str;

and run edgedb migration create && edgedb migrate again:

Created dbschema/migrations/00002.edgeql, id: m1z66inv2m6nxbebbt5lvv7zv7ksghemwkxpeemq6uqg7pvht72nnq
Applied m1z66inv2m6nxbebbt5lvv7zv7ksghemwkxpeemq6uqg7pvht72nnq (00002.edgeql)
@elprans
Copy link
Member

elprans commented Sep 12, 2022

Should be fixed in #4248 due in 2.2 in a couple of days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants