geldata / geldata/gel

ISE on coalesce operator (`??`) between named tuples in update

Open
#8,917 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14.2k
Forks
450
PR merge metrics
No merged PRs in 30d

Description

Coalescing a named tuple with the existing property value throws an ISE

```edgeql
with
product := '66d52662-6caa-11f0-8b4e-f71195ea4457',
new_price := >(cents := 100, currency := Currency.ARS),
# Can also be received by param which is how i observed it:
# new_price := >$price,

# select product {
# value := new_price ?? .price, # OK
# }

update product
set {
# price := new_price, # OK
price := new_price ?? .price, # <-- ISE
}
```

This raises
```
InternalServerError: a column definition list is redundant for a function returning a named composite type
```

There are [a few issues](https://github.com/geldata/gel/issues?q=is%3Aissue%20column%20definition%20list) about this error, https://github.com/geldata/gel/issues/5905 specifically mentions named tuples.

- Gel Version: 6.9+77bc1f3
- Gel CLI Version: Gel CLI 7.7.0+3788f53
- OS Version: Fedora release 41 (Forty One)

**Steps to Reproduce:**

1. Use schema
2. Insert an entry
3. Run query to update that entry (adjusting uuid)

**Schema:**

Haven't tested this but here's a reduced version of what i have).

```edgeql
using future simple_scoping;

module default {
scalar type PriceCents extending int64 {
constraint min_value(0);
}
scalar type Currency extending enum;

type Product {
required price: tuple;
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied update query with the reduced schema, checking the named-tuple coalesce behavior against the working select example. Compare the parameter and literal forms described in the issue, then confirm that the update completes without the redundant column definition list error.

Written by the indexing model from the issue text.

Assessment

Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.