#34255: Annotation/group by with an expression on psycopg3
-------------------------------------+-------------------------------------
Reporter: Guillaume Andreu | Owner: nobody
Sabater |
Type: Bug | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: orm postgres | Triage Stage: Accepted
psycopg3 annotation groupby |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Florian Apolloner):
Replying to [comment:10 Simon Charette]:
> I'm not sure what you mean here by server side cursors. Did you mean
server side bindings?
Lol yes
> I'm not sure what's causing it to be stricter but if pyscopg>=3 allows
for psycopg2 style of parameter bindings we should default to it until we
can figure out an adequate solution here. If that doesn't work I can
commit time to solving this issue but I fear the solution won't be pretty.
ACK. As Mariusz pointed out we already do some shenanigans for Oracle --
so maybe Oracle does server-side bindings as well? Still I wouldn't
surprised if Postgresql is stricter and complains about more things :) But
with psycopg3 using server-side bindings we might have more motivation to
fix this than for Oracle -- though I think everyone would benefit from
named params if we manage to do this. I am just not sure if we can do this
easily, we might have to support a mix of `%s` and `%(name)` in queries
for a while or so :/
As for psycopg2 style parameter bindings: Yes psycopg3 supports this since
3.1 https://www.psycopg.org/psycopg3/docs/advanced/cursors.html#client-
side-binding-cursors and those should bring it back to a more psycopg2
like behavior. This was to be my escape hatch all along ;) We still might
need a fix or two in Django itself since I am not 100% sure that the geo
adapters might work fully in "text"-mode which is required for client-side
bindings.
--
Ticket URL: <https://code.djangoproject.com/ticket/34255#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070185af634d85-7dde12b4-7ac7-4ab4-8983-2ff4ad222f53-000000%40eu-central-1.amazonses.com.