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 1wNA09-000cPN-0T for pgsql-bugs@arkaria.postgresql.org; Wed, 13 May 2026 13:51:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wNA06-0094Ig-2K for pgsql-bugs@arkaria.postgresql.org; Wed, 13 May 2026 13:51:50 +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 1wNA06-0094IY-1Y for pgsql-bugs@lists.postgresql.org; Wed, 13 May 2026 13:51:50 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wNA03-00000000PJT-3tSy for pgsql-bugs@lists.postgresql.org; Wed, 13 May 2026 13:51:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 64DDpdbg165554; Wed, 13 May 2026 09:51:39 -0400 From: Tom Lane To: Marcelo Lauxen cc: pgsql-bugs@lists.postgresql.org Subject: =?UTF-8?Q?Re:_pg=5Fget=5Findexdef()_output_not_idempotent_for_par?= =?UTF-8?Q?tial_indexes_with_ALL(ARRAY[=E2=80=A6])::text[]?= In-reply-to: References: Comments: In-reply-to Marcelo Lauxen message dated "Tue, 12 May 2026 15:03:14 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <165552.1778680299.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Wed, 13 May 2026 09:51:39 -0400 Message-ID: <165553.1778680299@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Marcelo Lauxen writes: > *PostgreSQL version*: 18.3 (Homebrew) on aarch64-apple-darwin24.6.0 > *pg_get_indexdef()* produces SQL that, when executed, yields a different > pg_get_indexdef() output. This means a pg_dump → pg_restore cycle silently > changes the deparsed form of partial index WHERE clauses that use NOT IN > (...) on a varchar column, causing cosmetic drift in tools that compare > index definitions (e.g. ORM schema dumps, annotation generators). You are assuming a property that we've never guaranteed and don't plan to start guaranteeing, ie that the output of expression decompilation matches the input even in semantically-insignificant details. My own advice about how to fix this particular example is not to use varchar --- especially not unconstrained varchar, which doesn't even have the thin excuse of being spec-compliant. Postgres' native string type is text. regards, tom lane