Repository: edgedb/edgedb

Issue:
ISE: Relation edgedbpub.<uuid> does not exist during inserts
EdgeDB 3.0-dev.7456+local (repl 3.0.0-dev)

Not sure what is causing this.
```
Type \help for help, \quit to quit.
edgedb> insert Test3;
{default::Test3 {id: 7e4d79ae-daf1-11ed-b024-a75a898789c5}}
edgedb> insert Test4 { test3ref := (select Test3 limit 1)};
edgedb error: InternalServerError: relation "edgedbpub.77170bf0-daf1-11ed-ba23-0d883fd68fbd" does not exist
  Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
  Server traceback:
      edb.errors.InternalServerError: relation "edgedbpub.77170bf0-daf1-11ed-ba23-0d883fd68fbd" does not exist
edgedb> 
```

Schema: 
```
type Test4 {
    name : str {
        default := "test4"
    }

    test3ref : Test3 {
        property note := .name
    }
}
```


Discussion:
The reason for writing this schema:

I would like to test whether the computed link property `note` with leading dot notation refers to that of source of the link, or the target of the link. (I am inferring it is the target). 
This may be a related issue: https://github.com/edgedb/edgedb-js/issues/569
An error with a similar message happens when the js querybuilder runs introspection on scalar types in the latest nightlies (and reproduces for me with a clean instance). It seems to be this part of the introspection query in particular causing the issue:
```edgeql
select schema::InheritingObject {
  children := .<bases[IS schema::Type],
  descendants := .<ancestors[IS schema::Type]
};
```
Removing either of the `children` or `descendants` lines fixes the issue.
It seems that `edgedbpub."test3ref_t"` of `ins_rewrites~1` is optimized/replaced into `edgedbpub.<uuid>`, and that doesn't exist.
It seems that the `edgepub.<uuid>` for test3ref is not generated correctly

Resolving patch:
diff --git a/edb/schema/links.py b/edb/schema/links.py
--- a/edb/schema/links.py
+++ b/edb/schema/links.py
@@ -139,7 +139,8 @@ def scalar(self) -> bool:
 
     def has_user_defined_properties(self, schema: s_schema.Schema) -> bool:
         return bool([p for p in self.get_pointers(schema).objects(schema)
-                     if not p.is_special_pointer(schema)])
+                     if not p.is_special_pointer(schema)
+                     and not p.is_pure_computable(schema)])
 
     def get_source(
         self,


Test patch:
diff --git a/tests/test_edgeql_linkprops.py b/tests/test_edgeql_linkprops.py
--- a/tests/test_edgeql_linkprops.py
+++ b/tests/test_edgeql_linkprops.py
@@ -1550,3 +1550,28 @@ async def test_edgeql_props_tuples_01(self):
             ''',
             [True],
         )
+
+    async def test_edgeql_pure_computed_linkprops_01(self):
+        await self.con.execute(r'''
+            CREATE TYPE default::Test3 {
+                CREATE PROPERTY name: std::str {
+                    SET default := 'test3';
+                };
+            };
+            CREATE TYPE default::Test4 {
+                CREATE LINK test3ref: default::Test3 {
+                    CREATE PROPERTY note := (.name);
+                };
+                CREATE PROPERTY name: std::str {
+                    SET default := 'test4';
+                };
+            };
+            insert Test3;
+        ''')
+
+        await self.assert_query_result(
+            '''
+            insert Test4 { test3ref := (select Test3 limit 1)};
+            ''',
+            [{}],
+        )