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.96) (envelope-from ) id 1wEeD7-004FLD-15 for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Apr 2026 02:18:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wEeD5-000EZo-0s for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Apr 2026 02:18:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wEeD5-000EZf-00 for pgsql-bugs@lists.postgresql.org; Mon, 20 Apr 2026 02:18:03 +0000 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wEeD2-000000023pO-3lKt for pgsql-bugs@lists.postgresql.org; Mon, 20 Apr 2026 02:18:02 +0000 Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-7dbe07d3ec3so1235367a34.0 for ; Sun, 19 Apr 2026 19:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776651479; cv=none; d=google.com; s=arc-20240605; b=R/HIeo46D/yU6GYpnDX+w92VXIY6zR2LTmalEqjC8Ouq0AVWK/zfTACf93Po/58CNJ r3z8TMM4JdXRkxK/w7FWtAJvQmr1o24zNdqOuBtTziX5pNlKz/gi0EE6ujYBOVUMUD6x /0YlW3EQNNrU9XufRxGONCKq/M9utPVAJf/ce2z1K3HR+Se6PhIn+yfFKBp51ZLJyDUj N5NLQfqf+lUS26Ru1ouCrGzeCNDLE4HJGl1mAvhklWe039Dm3+TS5eLabg3VNR3zB8E0 txDDnljjCt4UhoBdAqlULPXK55UJi9NIxG2aH6kRsp2C3AYHO3eb+Jd53As0G8ERK2mL kslA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=HD9+2ySImnu2tTf5drZDl1RoChh8+up44vHiTh2x8wc=; fh=fTE0Tfel5/c/jis2bliCct2NMl5r9X6zyKrB/VuzLuo=; b=Ki1gZwd7n6GSZsgFAC/mfSO/TFjDbQImeK29RYk3/5mCFe+s1XP/GMJrYgfqC1xaYc 9dCDMxcAm4uwg1yvEe9hoeYGhqRHYJQjQdl7fNM6mlTFJ1K7Pr/KNvUJv3ilVj1bRTL2 Z54IwCslvjiEdRZlJ+M2vm/9IjYpWewJq4XCX8KZkYQKKJkPHNIZvTy0W1NlKXM2D6hj bfP2uypSlkMqS4Fha8CDOCucsNoI+FTGnnPrSEC1JW7bEU2SMlRjp6oEj7uMT49okVkp N68Oh/wlcdry7qKOezLcEVtLjvnjujc/vNry63iklQNG/zRhnavsJxHUteclrQlDjC17 flLg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776651479; x=1777256279; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HD9+2ySImnu2tTf5drZDl1RoChh8+up44vHiTh2x8wc=; b=kaQK0ltypqjWi6lZtTtM3MEOqq9IbmCIe+UBaYF76aoy0Nx/zDmWqlyMHKpuqpK7BX 20+tNxBnGcLuwcQ8X4l7k/YcRddW5JcVdz9uDX9jX+Lc6ieVt9YqPT1yRXna9TJEECxu i/ZrC+n232SPJlyqUx8CWPZRiYcozzIIsLzOQrhu7ByYINjCK/rq7VYDcYkdZCKbH9nz mPxU4waWq8B6575Wqf8NGJVCJF9VcR8KwLMkb/Fn9C8CRpSVPEZLewbwoaeHcisKdtBt 8LG/ruyeE4mbQhkNwSvnrgQZDCc3p1iZK7fxQnWmJ8GgfAlydk88Gv5VZltNHFzquz9q YkrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776651479; x=1777256279; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HD9+2ySImnu2tTf5drZDl1RoChh8+up44vHiTh2x8wc=; b=R/ew1S2yGyXBzGwpkv3LRwWCteKq1aap2+8CX/5iWjYKip6DWqRnIIcV0mmGQG274X yvfb5CzheNTYRLbbewxL4pp24yiGjp+R9ipafy2g+yNJaOP1ooL7CwYk7/+2vYltnPYt JG1Daxj/kv8CxW5+d1K05ZBlU5ZtslswOmhgNXwCStwlt5GT8BmgWlTGnBGmIefuVQA+ 5h7W6++QtGoLIqVUe8KJkbdYsqj1WK1PuCoATDrYeAbCSMsBtqbbQPY0WjQVCwjXkJg8 j3EbDLvuY4w+JxqGly7F7UwmXHEqU7GKyFjDMtzhgfhEzZrtO8u0zMtadhV+SNro2eyS SXsg== X-Forwarded-Encrypted: i=1; AFNElJ89aS+Cahqcy2xq/kFmWeRYZ1xeYzdFI2fgaB3TArICiKZF9pW8sgVanjumPdGKPDrGC0QwzU3LbtAO@lists.postgresql.org X-Gm-Message-State: AOJu0Yz+LWUyRNWH4W2QEaje1P7TylzB+cRpqb0awxUks2ourW3OMKuc 8ix9IXtjFfvJOzDSHLLPMs0u8BYEWBQPTp5pP/t2uTrqxxcQaaBadDnocJMOizHKXRLMfW/ZYBO 0yXMKUR8RJmGMXwGC904VAIfbFnFUq+k= X-Gm-Gg: AeBDiev6h3mOb6nz1VJUC07flSQYwWVdKH7EAhwL5RlM0Z6qk2NdsCJyloAWxZpVzhR OmSIkhhzgsPZn6SrnP2+3+tRY16PWRoW3mM0o0spn2Rxi7Jc36Q9h2kzaKrlmA4fY4VoO6KMFPD j4l6aJ9GHEhrZTv0+2swEabp7bmsfO2iswfZPCpSpFHQ/LnO3UmST1Yrj+mZ5AJO0plvZmyOAgQ g3EOUAo5DuCSbJMxgt3wcbl9dbdr8q86U3wLY5hBPZJCPkRFKtv2mGjMnf7AmvompdYaDt8oY6w L9W1h1f+LnrtqfbvP5Q= X-Received: by 2002:a05:6820:205:b0:694:8683:3860 with SMTP id 006d021491bc7-694868339b1mr579447eaf.48.1776651478653; Sun, 19 Apr 2026 19:17:58 -0700 (PDT) MIME-Version: 1.0 References: <19460-5625143cef66012f@postgresql.org> <53936.1776633020@sss.pgh.pa.us> <81857.1776648374@sss.pgh.pa.us> In-Reply-To: <81857.1776648374@sss.pgh.pa.us> From: Richard Guo Date: Mon, 20 Apr 2026 11:17:47 +0900 X-Gm-Features: AQROBzD0j-HCsLcO7ldXc7Ujf9KDwAExRSmiy5S2FE3jV39ScAd399daVz3w-Ws Message-ID: Subject: Re: BUG #19460: FULL JOIN rewriting issue on empty queries To: Tom Lane Cc: francois.jehl@pigment.com, pgsql-bugs@lists.postgresql.org, Robert Haas Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Apr 20, 2026 at 10:26=E2=80=AFAM Tom Lane wrote= : > Thanks for looking at it! There is a loose end still bothering me: > if you remove the lower "WHERE t.id =3D ..." clause, or change it to be > something other than an equality constraint on t.id, the bug doesn't > manifest. The reason for that is un-obvious. The reason seems to be that the equality constraint is a restriction clause for the inner relation 't', and is needed to determine that the relation has a matching unique index and is therefore distinct. If we remove it, or change it to something that isn't mergejoinable, we won't be able to prove the inner side of the left join is distinct, and thus won't be able to remove that left join. I think the qual clause "sub.id =3D empty_source.id" might be confusing, because empty_source.id is constant NULL, and this clause would be simplified to constant NULL during const-folding. - Richard