Re: Query with boolean parameter

2022-03-19 Thread Paolo De Stefani
Il 19/03/2022 17:35 Christophe Pettus ha scritto: On Mar 19, 2022, at 05:10, Paolo De Stefani wrote: Switching to psycopg 3 i have to consider many more differences than i expected There have been some changes in the way psycopg2 does parameter substitution, although that one is an interestin

Re: Query with boolean parameter

2022-03-19 Thread Adrian Klaver
On 3/19/22 05:10, Paolo De Stefani wrote: Il 19/03/2022 01:00 Christophe Pettus ha scritto: On Mar 18, 2022, at 16:56, Paolo De Stefani wrote: Is there any reason why the second query results in a syntax error? There's not IS operator in PostgreSQL (or in SQL).  IS NULL, IS NOT NULL, IS TRUE

Re: Query with boolean parameter

2022-03-19 Thread Christophe Pettus
> On Mar 19, 2022, at 05:10, Paolo De Stefani wrote: > Switching to psycopg 3 i have to consider many more differences than i > expected There have been some changes in the way psycopg2 does parameter substitution, although that one is an interesting case! You might consider using IS DISTIN

Re: Query with boolean parameter

2022-03-19 Thread Daniele Varrazzo
> Il 19/03/2022 01:00 Christophe Pettus ha scritto:> >> On Mar 18, 2022, at > 16:56, Paolo De Stefani > >> wrote: > >> Is there any reason why the second query results in a syntax error? > > > > There's not IS operator in PostgreSQL (or in SQL). IS NULL, IS NOT > > NULL, IS TRUE, and IS FALSE ar

Re: Query with boolean parameter

2022-03-19 Thread Paolo De Stefani
Il 19/03/2022 01:00 Christophe Pettus ha scritto: On Mar 18, 2022, at 16:56, Paolo De Stefani wrote: Is there any reason why the second query results in a syntax error? There's not IS operator in PostgreSQL (or in SQL). IS NULL, IS NOT NULL, IS TRUE, and IS FALSE are in effect unary postfix

Re: Query with boolean parameter

2022-03-18 Thread Christophe Pettus
> On Mar 18, 2022, at 16:56, Paolo De Stefani wrote: > Is there any reason why the second query results in a syntax error? There's not IS operator in PostgreSQL (or in SQL). IS NULL, IS NOT NULL, IS TRUE, and IS FALSE are in effect unary postfix operators, so you can't construct them that w

Query with boolean parameter

2022-03-18 Thread Paolo De Stefani
Hi all Regarding query and parameter binding in psycopg3: cur.execute('SELECT * FROM system.app_user WHERE can_edit_views = %s', (True,)) user=postgres database=test4) at 0x127b7f0> cur.execute('SELECT * FROM system.app_user WHERE can_edit_views IS %s', (True,)) Traceback (most recent call las