-- Lab4: message text may contain U+0000, which PostgreSQL TEXT/JSONB cannot store. -- Text is kept as exact UTF-8 bytes; the idempotent response snapshot as JSON -- (textual JSON keeps the "\u0000" escape, JSONB rejects it). ALTER TABLE messages ALTER COLUMN text TYPE BYTEA USING convert_to(text, 'UTF8'); ALTER TABLE idempotency_records ALTER COLUMN response_body TYPE JSON USING response_body::json;