Re: [psycopg] Solving the SQL composition problem - Mailing list psycopg

From Daniele Varrazzo
Subject Re: [psycopg] Solving the SQL composition problem
Date
Msg-id CA+mi_8aTWKpMfkfez=yKQyWP0Rw72cncJ8MZ9pdcCT6QYuug8w@mail.gmail.com
Whole thread Raw
In response to Re: [psycopg] Solving the SQL composition problem  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List psycopg
On Tue, Jan 3, 2017 at 5:24 PM, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:

> What I'm suggesting is to let Postgres handle the replacement of normal
> values, using the prepared statement syntax of $1, $2, etc[1], and only do
> identifier replacement in python (using quote_ident). That means a lot less
> time spent parsing, and opens the door for eventually doing more efficient
> stuff over the wire, like using binary type formats.
>
> 1: https://www.postgresql.org/docs/current/static/sql-prepare.html

Hi Jim,

this is a very desirable feature. However it would be a major source
of backward incompatibility. Even keeping the placeholders as %s or
%(name)s some query would stop working because of different postgresql
cast rules and because PQexecParams doesn't support passing several
semicolon-separated statements at once. We will eventually get there
in another major release of the adapter. Adrian has already posted a
link with further discussion about the topic.

-- Daniele


psycopg by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: [psycopg] Solving the SQL composition problem
Next
From: Jim Nasby
Date:
Subject: Re: [psycopg] Solving the SQL composition problem