I'm unable to create a string in PostgreSQL with semicolon after a single quote. eg. I need to create a string like:
Delhi is India's capital; It's a beautiful state
How do I create such a string?
I tried the following:
select 'Delhi is India\'s capital; It\'s a beautiful state'
I'm getting the following error :
Invalid operation: unterminated quoted string at or near "'Delhi is India\'s capital"
Position: 8;
In SQL, you don't escape single quotes with a backslash, but by doubling them. The semicolon doesn't need a escaping.
So you should use
SELECT 'Delhi is India''s capital; It''s a beautiful state';