On Fri, Dec 14, 2018 at 04:31:00PM +0100, Christoph Zwerschke wrote:
> Am 14.12.2018 um 14:57 schrieb Justin Pryzby:
> > Maybe it's easier than that..
> > I saw two issues.  First, EXECUTE %s wasn't "adapted" to $1 (since
> > there were no parameters passed).
> > Second, execute failed with inline=False.
> > But actually, SQL EXECUTE doesn't accept parameters,
> > they MUST be inline.
> > https://www.postgresql.org/docs/11/sql-execute.html
> 
> That second issue seems to be correct - it only works when the parameters in
> SQL EXECUTE are sent inline. But I don't see where this is mentioned in the
> link you posted above, and I don't see your first issue. It works for me

I should have said: PREPARE %s is not adapted.

As I wrote last week, that works using postgres dollar params.
My request is to enable adaptation for PREPARE, which takes no parameters.

My hack added a kwarg prepare=False, but maybe it's reasonable and easy to add
a separate function for that.  I guess it would be same signature:
|prepare(self, command, params)

The alternative is I can move forward with what I've already done in our
application, which is essentially the same as what I used in my hack for
prepare=True:
|literals = ['$%s'%x for x in range(1,1+len(values))]

Now that I've re/read through how pygres does this, I guess it matters little
to me whether that list comprehension is in pg.py or whether I put it in our
application.

It would be nice to add PQexecPrepared to allow sending params without the
overhead of parsing of sql.

Justin
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo/pygresql

Reply via email to