Writing a string longer than STRING[n] into a data property: a single value is silently cut, a set-based write fails with a raw PostgreSQL "value too long" error
@danchanka ci sta già lavorando.
Dal 16/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Description
A string value longer than the length of the target STRING[n] / ISTRING[n] data property is handled differently depending on how it is written:
- a single value — a parameterless property, or one object given as a value — is cut to
ncharacters without any message; - a write over a set of objects — an assignment with parameters, a
FORmerged into one change, or one constant writtenWHEREto several objects — is not cut. It fails with the PostgreSQL errorvalue too long for type character varying(n): at the assignment when the value is computed per row, or later atAPPLYwhen one constant is written to several objects (the session keeps the uncut value until then).
The explicit conversion STRING[n](...) cuts the value to n characters.
Reproducer (platform 7.0-SNAPSHOT, PostgreSQL 18, run through /eval):
s5 = DATA LOCAL STRING[5] ();
s5k = DATA LOCAL STRING[5] (INTEGER);
p = DATA LOCAL STRING[4] (INTEGER);
q = DATA LOCAL STRING[4] (INTEGER);
run() {
s5() <- 'abcdefgh'; // 'abcde' - cut
s5k(1) <- 'abcdefgh'; // 'abcde' - cut
s5k(INTEGER i) <- 'abcdefgh' WHERE iterate(i, 1, 3); // s5k(1) reads back as 'abcdefgh' - 8 characters kept in the session
p(INTEGER i) <- 'abcd' WHERE iterate(i, 1, 3);
q(INTEGER i) <- 'efgh' WHERE iterate(i, 1, 3);
s5k(INTEGER i) <- p(i) + q(i) WHERE iterate(i, 1, 3); // ERROR: value too long for type character varying(5)
EXPORT FROM a = s5(), b = s5k(1);
}
With a stored property (name = DATA ISTRING[100] (Item)):
probeNew = DATA LOCAL BOOLEAN (Item);
run() {
NEWSESSION {
NEW a = Item { probeNew(a) <- TRUE; }
NEW b = Item { probeNew(b) <- TRUE; }
name(Item i) <- '<101 characters>' WHERE probeNew(i); // passes: the session reads the name back with length 101
APPLY; // ERROR: value too long for type character varying(100)
}
}
and name(Item i) <- '<101 characters>' + STRING(i) WHERE probeNew(i); fails already at the assignment with the same error.
Expected: one rule for every write, independent of whether the value goes to one object or to a set — either the value is cut to n the way the explicit conversion cuts it, or the write is rejected with a platform error that names the property and the length instead of a database error.
Fix
Either apply the conversion to the declared string class in the set-based write path (session table and apply), the way it is applied to a single value and by the conversion operator, or check the length in both paths and raise a platform error naming the property.
Reason
A single value is read into memory and converted to the property's class before it is stored; a set-based change is written by a database query into a session table — and at apply into the stored table — whose column has the declared length, without any conversion, so the database rejects the row. The two paths were never aligned, and the error that reaches the developer is the raw database message.
- Lingua principale
- Java
- Stelle
- 214
- Fork
- 46
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lsfusion/platform
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
Tutte le issue di lsfusion/platform
Issue simili
-
account assessment course feature lecture
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
app:learninggoalhub enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
PropertyResolver fails on JDK classes with a non-public field named like the propertyForse già presa @vaibhavgupta443 l’ha presa oggi. Apertagood first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
apache/wicket#1991 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100