public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Marcelo Lauxen <[email protected]>
Cc: [email protected]
Subject: Re: pg_get_indexdef() output not idempotent for partial indexes with ALL(ARRAY[…])::text[]
Date: Wed, 13 May 2026 09:51:39 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CANKisB3AG6JK1tCMp4myj75tF3t93pEK_ojECdJ=Fnin-E+J_A@mail.gmail.com>
References: <CANKisB3AG6JK1tCMp4myj75tF3t93pEK_ojECdJ=Fnin-E+J_A@mail.gmail.com>
Marcelo Lauxen <[email protected]> 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
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: pg_get_indexdef() output not idempotent for partial indexes with ALL(ARRAY[…])::text[]
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox