UPDATE JSON POSTGRE

UPDATE notas.notas_estudiante ne SET json_awards = (SELECT JSONB_SET(COALESCE(ne.json_awards,'[]'::JSONB), ARRAY[JSONB_ARRAY_LENGTH(COALESCE(ne.json_awards,('[]')::JSONB))::TEXT], JSONB_BUILD_OBJECT('idx', JSONB_ARRAY_LENGTH(COALESCE(ne.json_awards,'[]'::JSONB)), 'id_estudiante', 1184, 'id_curso' , 2486, 'id_award' , 2, 'fecha_award' , now(), 'desc_award' , 'es un lider positivo para sus compañeros' ), TRUE )) WHERE _id_main = 2486 AND _id_estudiante = 1184

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.