Skip to content
← Back to activity

Solution skill

Rewrite in abstract types possible?

Version 2Sign in to save

Complete solution

Shows how to fix rewrite in abstract types possible?. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

For "InternalServerError: could not resolve trailing pointer class for (derived::old)": what was reported: Issue geldata/gel#5883 (closed, 12 comments): - EdgeDB Version: 4.0-dev.7696+eae6d5a - EdgeDB CLI Version: 3.5.0-dev.1025+fec3413 - OS Version: Linux hp 6.1.39-1-lts #1 SMP PREEMPTDYNAMIC Wed, 19 Jul 2023 17:58:31 +0000 x8664 GNU/Linux Steps to Reproduce: 1. insert Foo { name := "f1" }; 2. update Foo set { name := "f1" }; `` InternalServerError: could not resolve trailing pointer class for (\\derived\\::\\old\\) Hint: This is most likely a bug in EdgeDB.

InternalServerError: could not resolve trailing pointer class for (__derived__::__old__)
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

Steps

  1. What was reported:

Issue geldata/gel#5883 (closed, 12 comments): - EdgeDB Version: 4.0-dev.7696+eae6d5a

  • EdgeDB CLI Version: 3.5.0-dev.1025+fec3413
  • OS Version: Linux hp 6.1.39-1-lts #1 SMP PREEMPTDYNAMIC Wed, 19 Jul 2023 17:58:31 +0000 x8664 GNU/Linux
  1. insert Foo { name := "f1" };
  2. update Foo set { name := "f1" };
InternalServerError: could not resolve trailing pointer class for (__derived__::__old__)
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
  1. `

abstract type Revisable { ...

  1. What works:

Comparing objects with = only compares ids, so to bump a revision only when properties actually changed, compare the unpacked JSON property sets:

  1. rewrite update using ( (old.rev + 1) if exists ((select jsonobjectunpack([json]subject{}) except jsonobjectunpack([json]old{}))) else old.rev

);

  1. The maintainer confirmed this works for detecting property changes. Caveat from the thread: this is a workaround, not the idiomatic way. A proper structural comparison (something like std::eq_properties()) does not exist yet; it is tracked separately as issue #5335.

Expected: What works: Comparing objects with = only compares ids, so to bump a revision only when properties actually changed, compare the unpacked JSON property sets: rewrite update using ( (\\old\\.rev + 1) if exists ((select json\object\unpack([json]\\subject\\{}) except json\object\unpack([json]\\old\\{}))) else \\old\\.rev ); The maintainer confirmed this works for detecting property changes.

When to use

You are seeing this: Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug\_report.md Schema: abstract type Revisable {... Use this skill when you run into "Rewrite in abstract types possible?".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 4.0-dev.7696, 3.5.0-dev.1025, hp 6.1.39-1. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Edge cases

  • Caveat from the thread: this is a workaround, not the idiomatic way.

Sources

  • https://github.com/edgedb/edgedb/issues/new?template=bug_report.md

Evidence

In the GitHub issue, the reporter asked: Rewrite in abstract types possible?. The working answer that came out of the thread: Comparing objects with = only compares ids, so to bump a revision only when properties actually changed, compare the unpacked JSON property sets:

rewrite update using ( (old.rev + 1) if exists ((select jsonobjectunpack([json]subject{}) except jsonobjectunpack([json]old{}))) else old.rev );

The maintainer confirmed this works for detecting property changes. Caveat from the thread: this is a workaround, not the idiomatic way. A proper structural comparison (something like std::eq_properties()) does not exist yet; it is tracked separately as issue #5335. Source: https://github.com/geldata/gel/issues/5883

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_UKBdaHuya4QskKSR7ARlmw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Rewrite in abstract types possible? <span>— Vectle</span></a>