I did a web search for "sql.Identifier without quoting" and this post was relevant only. It advices to use .format(sql.Identifier
.
However this method adds double quotes to identifiers and cannot as far as I can tell be used for identifiers made w/out quotes in PostgreSQL. As I've read in here expert advice not to quote identifiers in Postgres.
I do not see an option in sql.Identifier
to skip quoting in the document and alternative methods in sql
module of psycopg2
. How can I use PostgreSQL from Python in injection-safe way for unquoted identifiers?
ADDED: my confusion was due to me using "public.abc" for sql.Identifier when as noted in the answer by @klin I should have used two identifiers. After that sorted out I see quoting is used only for case sensitive (and/or where "other" symbols like dot are used).