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 1q41jZ-0001Bu-Mk for pgsql-general@arkaria.postgresql.org; Tue, 30 May 2023 15:58:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q41jY-0002Xn-9a for pgsql-general@arkaria.postgresql.org; Tue, 30 May 2023 15:58:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q41jX-0002Xe-T3 for pgsql-general@lists.postgresql.org; Tue, 30 May 2023 15:58:03 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q41jU-0035uV-UU for pgsql-general@lists.postgresql.org; Tue, 30 May 2023 15:58:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=HR8wM+z5YvuDm7qp0g1s/lXAxzZzxXCVkmLzFKUlVCM=; b=n6KvToO6PwobmUW3J1+P46fxZ9 p5hL8TQFatCyaClahWyIgTBFwN5kilfevLWGkuIzfIG/VbKyrZayJiCygEHpL/BFMk2W+9de87v7o Fbe8zDBcBOfwK19+BhXF1LJbcz3OSTRoSzV2c4TXmwdI2vsqaD3yCmbOLzTPvVdzLnSI=; Received: from depesz by depesz.com with local (Exim 4.94.2) (envelope-from ) id 1q41jT-00A3CA-3p; Tue, 30 May 2023 17:57:59 +0200 Date: Tue, 30 May 2023 17:57:59 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Marc Millas Cc: Adrian Klaver , "pgsql-general@lists.postgresql.org" Subject: Re: syntax pb Message-ID: Reply-To: depesz@depesz.com References: <02bd7734-9e59-8bbf-f39b-e0bc484c3912@aklaver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, May 30, 2023 at 05:53:30PM +0200, Marc Millas wrote: > Thanks Adrian, but if the query becomes more complex, for example with a > few joins more, then even casting doesn't work. > This comes from a prod environment and even casting NULLs (which is more > than strange, BTW) generates absurd errors. > Too my understanding it looks like the parser did not parse the select > distinct as we think he does. Show *real* example that doesn't work, with schema. Clearly your example can be easily made to work. Best regards, depesz