Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nVMXE-0002Sc-07 for psycopg@arkaria.postgresql.org; Sat, 19 Mar 2022 00:01:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nVMXC-0002qu-Ju for psycopg@arkaria.postgresql.org; Sat, 19 Mar 2022 00:01:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nVMXC-0002ql-De for psycopg@lists.postgresql.org; Sat, 19 Mar 2022 00:01:30 +0000 Received: from smtp72.ord1c.emailsrvr.com ([108.166.43.72]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nVMX9-0008OV-HU for psycopg@postgresql.org; Sat, 19 Mar 2022 00:01:29 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp10.relay.ord1c.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 77E0F40346; Fri, 18 Mar 2022 20:01:25 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: Query with boolean parameter From: Christophe Pettus In-Reply-To: <8df15d1263aaa1a9d36eacb0e5b9a28e@paolodestefani.it> Date: Fri, 18 Mar 2022 17:00:20 -0700 Cc: Psycopg X-Mailbutler-Message-Id: B793DA48-4446-47BA-A07B-BE00FFCB5C03 Content-Transfer-Encoding: quoted-printable Message-Id: <74FC637F-2D25-4CD0-A075-9CB5293FCA5B@thebuild.com> References: <8df15d1263aaa1a9d36eacb0e5b9a28e@paolodestefani.it> To: Paolo De Stefani X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Classification-ID: 382b6e58-bef7-4d2d-a022-e9a656b131fd-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > 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 way via parameter substitution.=