1 Risposta
- Più recenti
- Maggior numero di voti
- Maggior numero di commenti
0
Since the customer is updating a value in a JSON doc, just use the built in PostgreSQL JSON functions
postgres=> CREATE TABLE test_json (a int, b jsonb);
CREATE TABLE
postgres=> INSERT INTO test_json
postgres-> VALUES (1, '{"key1": "abc"}'), (2, '{"key1": "xyz"}');
INSERT 0 2
postgres=> UPDATE test_json
postgres-> SET b = jsonb_set(b, '{key1}', (upper((b->'key1')::text))::jsonb);
UPDATE 2
postgres=> SELECT * FROM test_json;
a | b
---+-----------------
1 | {"key1": "ABC"}
2 | {"key1": "XYZ"}
(2 rows)
con risposta 4 anni fa
Contenuto pertinente
- AWS UFFICIALEAggiornata 2 anni fa
- AWS UFFICIALEAggiornata 3 anni fa
- Perché non riesco ad accedere o visualizzare i dati di Performance Insights in Amazon RDS per MySQL?AWS UFFICIALEAggiornata 3 anni fa