Sanitize schema name

From: Ludovic Gasc <gmludo(at)gmail(dot)com>
To: psycopg(at)postgresql(dot)org
Subject: Sanitize schema name
Date: 2015-05-06 20:56:48
Message-ID: CAON-fpF0Axc5XS7VPhzQNgsVsmTbkSuCxs5HT8+Ug9g8xCUsAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

Hi,

I want to sanitize the name of the schema in a SQL query, because the
schema name depends on the client.

The issue is that I can't sanitize the name via the standard way of
psycopg2, because it adds quotes around schema name.

I imagine it's the same issue with a table name. Do you have a suggestion
to bypass that ?

For now, the most secure way I've found is to test the presence of the
schema before launch each query, but not really efficient.

Regards.
--
Ludovic Gasc (GMLudo)
http://www.gmludo.eu/

Responses

Browse psycopg by date

  From Date Subject
Next Message Adrian Klaver 2015-05-06 21:08:48 Re: Sanitize schema name
Previous Message Adrian Klaver 2015-04-24 15:32:16 Re: Possible reasons for copy_from to never terminate?