appwrite / appwrite/appwrite

Operator.increment via updateRow returns 500 on tables with a point column (1.9.5)

Aperta
#12,866 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
product / databases
Lingua principale
TypeScript
Stelle
57.4k
Fork
5.7k
Merge medio
16h 27m
PR unite (30g)
291

Descrizione

### 👟 Reproduction steps

Minimal A/B (same project, same integer column, only difference is a `point` column):

1. Create table A with only an integer column `count` (not required, default `0`).
2. Create table B with integer column `count` **and** a required `point` column `location`.
3. Insert a row in each table with `count: 10` (table B also gets a valid point, e.g. `[-122.0, 37.0]`).
4. On each row, call:

```http
PATCH /v1/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}
Content-Type: application/json

{
"data": {
"count": "{\"method\":\"increment\",\"values\":[1]}"
}
}
```

SDK equivalent:

```dart
await tablesDB.updateRow(
databaseId: databaseId,
tableId: tableId,
rowId: rowId,
data: {
'count': Operator.increment(),
},
);
```

Observed:

- Table A (no point): **succeeds**
- Table B (with point): **fails** with `500 general_unknown`

5. On the failing table B row, the dedicated increment route still works:

```http
PATCH /v1/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/count/increment

{ "value": 1 }
```

### 👍 Expected behavior

`updateRow` with `Operator.increment()` should atomically increment the integer column on any table, including tables that also have a `point` column — same as `incrementRowColumn` / the `/increment` route.

### 👎 Actual Behavior

On tables that include a `point` column:

```json
{
"message": "Server Error",
"code": 500,
"type": "general_unknown",
"version": "1.9.5"
}
```

- No useful error body.
- Explicit assignment (e.g. `"count": 11`) on the same row works.
- `incrementRowColumn` / `/increment` on the same row works.
- Also fails when staged inside a multi-table transaction (commit returns the same 500).

On an otherwise identical table without a `point` column, the same `Operator.increment()` via `updateRow` works.

### 🎲 Appwrite version

Different version (specify in environment)

### 💻 Operating system

Linux

### 🧱 Your Environment

- Appwrite **1.9.5**
- Reproduced with the Dart server SDK and with raw HTTP
- Confirmed with a minimal A/B: integer-only table vs integer + required `point` column
- Workaround: use `TablesDB.incrementRowColumn(...)` (supports `transactionId`) instead of `Operator.increment()` in `updateRow` when the table has a `point` column

### 👀 Have you spent some time to check if this issue has been raised before?

- [x] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [x] I have read the [Code of Conduct](https://github.com/appwrite/.github/blob/main/CODE_OF_CONDUCT.md)

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo il confronto tra tabelle A/B tramite updateRow con Operator.increment(), quindi traccia la gestione del relativo operatore e confrontala con incrementRowColumn e la route /increment. Controlla anche il percorso delle transazioni; il lavoro è completato quando updateRow incrementa correttamente nelle tabelle con una colonna point, incluse le transazioni staged, senza la risposta 500.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
dart, typescript
Ambito
backend-api-design, databases
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.