Reputation: 33900
I have a TEXT column that actually contains a stringized JSON. Now I just want to convert it to a real JSONB. How to do this from psql
console?
Upvotes: 2
Views: 39
Reputation: 23676
If all data is valid JSON, then this should work:
ALTER TABLE mytable ALTER COLUMN mytext_col TYPE jsonb USING mytext_col::jsonb;
Upvotes: 2