Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uErDM-00E2GO-3h for pgsql-general@arkaria.postgresql.org; Tue, 13 May 2025 15:06:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uErDK-005yd7-Nw for pgsql-general@arkaria.postgresql.org; Tue, 13 May 2025 15:06:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uErDK-005ycz-9L for pgsql-general@lists.postgresql.org; Tue, 13 May 2025 15:06:38 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uErDH-001bNl-32 for pgsql-general@lists.postgresql.org; Tue, 13 May 2025 15:06:37 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 54DF6Vnh1465054; Tue, 13 May 2025 11:06:32 -0400 From: Tom Lane To: Markus Demleitner cc: pgsql-general@lists.postgresql.org Subject: Re: Index not used in certain nested views but not in others In-reply-to: <20250513144811.enpwh6sm5klsbkoc@victor> References: <20250430151647.7kootztymzznydn5@victor> <1400978.1746046929@sss.pgh.pa.us> <91e617539ff887f1aac4e27bf1481b51fcf4b131.camel@cybertec.at> <20250512141217.4dwnfxbaf53mhvi7@victor> <3847.1747145566@sss.pgh.pa.us> <20250513144811.enpwh6sm5klsbkoc@victor> Comments: In-reply-to Markus Demleitner message dated "Tue, 13 May 2025 16:48:11 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4148.1747148791.1@sss.pgh.pa.us> Date: Tue, 13 May 2025 11:06:31 -0400 Message-ID: <4149.1747148791@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Markus Demleitner writes: > On Tue, May 13, 2025 at 10:12:46AM -0400, Tom Lane wrote: >> Oh, well, that's your problem. The source tables' column types >> need to match. Otherwise the UNIONs don't get flattened and you >> don't get indexscans. > Ahhhh... *source* tables. Sure, once I'm out of desperation stun, it > kind of is unsurprising that the casts won't help me when it's about > pulling up the original tables. > Just to be sure: int and bigint don't mix, and neither do real and > double precision, right? [ checks code... ] Have to be the same datatype, but it looks like we don't care about typmod (eg, varchar max length) or collations. (hmm ... I'm wondering if nondeterministic collations have broken this ...) > And the lazybone in me can't resist asking: > there's absolutely no way around this? It would be a good bit of work, for sure. regards, tom lane