Re: How to insert either a value or the column default?

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: "W(dot) Matthew Wilson" <matt(at)tplus1(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to insert either a value or the column default?
Date: 2014-08-25 15:36:00
Message-ID: CA+mi_8YgxKzJVAzVtq2HrrNVcRh_2RMS7nxi4mJqV6Cf90ZB-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Aug 25, 2014 at 3:26 PM, Adrian Klaver
<adrian(dot)klaver(at)aklaver(dot)com> wrote:
> On 08/25/2014 06:32 AM, W. Matthew Wilson wrote:

>> First of all, thanks for showing this trick!
>>
>> But I am confused. Will this trick stop working in a future version
>> of psycopg2? Should I avoid using it?
>
>
> Here is the email laying out the issues:
>
> http://www.postgresql.org/message-id/AANLkTi=ym3SCQKCQBtp8RJHUswwAPOpjXYKTXS=aHWzp@mail.gmail.com

That's correct, thank you Adrian.

Matthew: no, this will correctly work in all the future psycopg2
versions. Even if we started supporting a new protocol, such as the
ISQLParam referred in the mentioned email, it won't be the default in
psycopg2 and it should be enabled on purpose.

The new protocol should be the default in this mythical psycopg3
instead. If something can be imported as psycopg2 it will support the
ISQLQuote protocol by default, hence the Default object as implemented
in this thread will work.

-- Daniele

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2014-08-25 16:09:07 Re: Query planner question
Previous Message Adrian Klaver 2014-08-25 14:26:48 Re: How to insert either a value or the column default?