0

I try to get the error from this call:

$ psql --dbname=synapse -c "SELECT     (json::JSONB->>'content')::JSONB->>'name' AS channel_name,     json::JSONB->>'room_id' AS room_id,     json::JSONB->>'sender' as sender FROM event_json WHERE json::JSONB->>'room_id' LIKE '%matrix.org%';";  
Pager usage is off.
FEHLER:  nicht unterstützte Unicode-Escape-Sequenz
DETAIL:  \u0000 kann nicht in »text« umgewandelt werden.
CONTEXT:  JSON-Daten, Zeile 1: ...": {"age_ts": 1535735391873}, "content": {"body":...

but the error message is cut off, how do I get the full error message?

2 Answers 2

0

What you see is just the part of the line where PostgreSQL sees a problem, you cannot bet more.

But since you know that the problem is in line 1, you should be able to

SELECT json
FROM event_json
WHERE json::JSONB->>'room_id' LIKE '%matrix.org%'
LIMIT 1;

and search for the offending \u0000.

0

It seems like the errormessage doesn't contain the nullbyte anyway, so since I didn't find the nullbyte, but I got around it by adding this to my statement:

 AND json NOT LIKE '%\u0000%'

working query:

psql --dbname=synapse -c "SELECT json::JSONB#>'{content,name}' as channel_name, json::JSONB->'room_id' AS room_id, json::JSONB->'sender' as sender FROM event_json WHERE json::JSONB->'type' = '\"m.room.name\"' AND json NOT LIKE '%\u0000%';"

I guess, the nullbyte is created, if the query returns an empty json string (but that is just a guess).

Not the answer you're looking for? Browse other questions tagged or ask your own question.