Re: How to insert either a value or the column default? - Mailing list pgsql-general

From Daniele Varrazzo
Subject Re: How to insert either a value or the column default?
Date
Msg-id CA+mi_8YgxKzJVAzVtq2HrrNVcRh_2RMS7nxi4mJqV6Cf90ZB-Q@mail.gmail.com
Whole thread Raw
In response to Re: How to insert either a value or the column default?  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On Mon, Aug 25, 2014 at 3:26 PM, Adrian Klaver
<adrian.klaver@aklaver.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


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: How to insert either a value or the column default?
Next
From: Jeff Janes
Date:
Subject: Re: Query planner question