public inbox for [email protected]
help / color / mirror / Atom feedFrom: Vladimir Ryabtsev <[email protected]>
To: Daniele Varrazzo <[email protected]>
Cc: Christophe Pettus <[email protected]>
Cc: Federico Di Gregorio <[email protected]>
Cc: [email protected]
Subject: Re: psycopg3 and adaptation choices
Date: Tue, 10 Nov 2020 11:00:28 -0800
Message-ID: <CAMqTPq=xmi67QHdhbaOh_EWsDWAR7rMf4MFGB9avsEP=dYzVXg@mail.gmail.com> (raw)
In-Reply-To: <CA+mi_8aWb9avqTtm=MZcNzUVvKvvWYS7BzcuCapgA9wnNFRyGQ@mail.gmail.com>
References: <CA+mi_8Zdk_beGcbOjkpdo+fchTR5ot1XM2zZc=ujSGqP+WVh-g@mail.gmail.com>
<[email protected]>
<CA+mi_8ZfV+rEDKaqM-pcSf43FuN4FUJGoGTxvEEXap-x_GWP0Q@mail.gmail.com>
<[email protected]>
<CA+mi_8YUEPfTPqD-1Jxm6NUwgJpWxPgejRZ+2-mPQr=0DQWiHA@mail.gmail.com>
<[email protected]>
<CA+mi_8a+Q0C2LwiedwNkRPVY=-G3q0zW6w19zYvvADtdEd4b_w@mail.gmail.com>
<[email protected]>
<CAMqTPqkac5xa=+kwKLj8DEr9OdrkJpEzJj4Re8VvKP=JeTdZog@mail.gmail.com>
<CA+mi_8aRQBG+Lz12oW0Be62RSR7UEEoev5Yn34ZSygcOgxbOCw@mail.gmail.com>
<[email protected]>
<CA+mi_8aWb9avqTtm=MZcNzUVvKvvWYS7BzcuCapgA9wnNFRyGQ@mail.gmail.com>
> I've added comparison tables with the choices available.
Nice article!
I see you have assigned weights to the upsides and downsides
and now these weights are going to determine the winner.
My particular question is regarding '-2' score for mapping numbers
to 'unknown'.
Why do you consider it such an important use-case? In my opinion,
such usage is just waste of resources and traffic, and if presenting
some constants in the result set is really required, other means,
such as 'SQL.format()`, might be a better option.
> Is it absurd to make the choice at execution time, based on the actual
value of the Python int?
If I got the idea correctly, it may lead to some inconsistent behaviour
in a series of executions of a prepared statement. Imagine you tested
you query with small numbers that fit into int4, but in production rarely
blogger values can come that must be sent as int8, which will lead to
occasional cast errors.
Vladimir
On Mon, 9 Nov 2020 at 19:43, Daniele Varrazzo <[email protected]>
wrote:
> On Tue, 10 Nov 2020 at 03:22, Christophe Pettus <[email protected]> wrote:
> >
> > > On Nov 9, 2020, at 19:20, Daniele Varrazzo <[email protected]>
> wrote:
> > >
> > > Choices to cast Python ``int`` type:
> >
> > Is it absurd to make the choice at execution time, based on the actual
> value of the Python int?
>
> I've been thinking a lot about it. I haven't completely ruled it out,
> but there are a few cases in which having different oids for the same
> query gets in the way. One that comes to mind is with prepared
> statements, either explicit (which I haven't exposed yet, but it's
> like the #1 request for a new feature), or implicit (currently using
> them to implement 'executemany()'). However I might be overestimating
> these issues, yes.
>
> I guess I should give an overview of the whole adaptation system: I'll
> try and write its documentation in the next few days. I have to start
> with the documentation somewhere...
>
> -- Daniele
>
view thread (23+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: psycopg3 and adaptation choices
In-Reply-To: <CAMqTPq=xmi67QHdhbaOh_EWsDWAR7rMf4MFGB9avsEP=dYzVXg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox