with sample_table(jsonb_column) as (
values ('{"data": "line 1\nline 2"}'::jsonb)
)
select *
from sample_table
where jsonb_column->>'data' ~ '^.*\n.*$'
The escaped string ā\nā has no special meaning in PostgreSQL, but it has a meaning inside JSONB column.
If you try to enter a new line character (chr(10)) in a JSONB column,
there will be an error stating:
Know more: