PostgreSQL – Escape single quote

You can escape the single quote character by making it a double single quote as shown below:

Example:

Insert into restaurants (id,name) values(1,'McDonald''s');

To insert the string <McDonald’s>, we have to escape the single quote by converting it into double single quote.

See also  PostgreSQL - Identify tables used by a View