I need to change the value of an XML attribute stored in a column using the XML datatype in a table before I return it to the client.
Right now I use a cursor, get xml, cast it to VARCHAR, parse it, change the attribute value (or add it if it is not present), put it in temporary table and return data from temporary table. Everything is done in a stored procedure (pl/pgsql).
I wonder if there is cleaner way to do this?