How to quote text before inserting into database? - Mailing list pgsql-general

From Scott Chapman
Subject How to quote text before inserting into database?
Date
Msg-id 200310172129.40718.scott_list@mischko.com
Whole thread Raw
Responses Re: How to quote text before inserting into database?  (Tino Wildenhain <tino@wildenhain.de>)
List pgsql-general
I am working with Python (psycopg).  I have HTML with embedded Python that I'm
inserting into a database and it could contain any character.

Single quotes, at least, must be escaped (to two single quotes, right?) before
inserting it into Postgres.

This poses a problem when I get the data out of the table.  It could have
originally contained two single quotes together and I replace them with one
single quote in the unescaping process.

How do you properly escape the special characters (and what all are they)?

TIA,
Scott

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Using subselects in INSERTs?
Next
From: Greg Stark
Date:
Subject: Re: VACUUM degrades performance significantly. Database