Hi.
On Mon, Nov 20, 2023 at 2:46 PM Daniele Varrazzo
<daniele.varrazzo@gmail.com> wrote:
So it turns out that the Django default, at least for 4.2 is ClientCursors :)
https://docs.djangoproject.com/en/4.2/ref/databases/#server-side-parameters-binding
Which means I can get the `quote` based solution work ootb.
Thanks a ton for the clarification.
AM
> but you can only use `PostgresDefaultValueType` with a ClientCursor
> (or in a `sql.Literal()`); you can visualize the query that a client
> cursor would execute using the classic `mogrify()`:
>
> >>> cur = psycopg.ClientCursor(conn)
> >>> cur.mogrify("INSERT INTO tbl (f1, f2) VALUES (%s, %s)",
> [PostgresDefaultValueType(), "hell'o"])
> "INSERT INTO tbl (f1, f2) VALUES (DEFAULT, 'hell''o')"
>