public inbox for [email protected]  
help / color / mirror / Atom feed
From: Marcelo Lauxen <[email protected]>
To: Tom Lane <[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 11:25:47 -0300
Message-ID: <CANKisB3F+=yZm-gK1RzcD761qUT56JT0LVOwe84Zg-QqBHZc3w@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CANKisB3AG6JK1tCMp4myj75tF3t93pEK_ojECdJ=Fnin-E+J_A@mail.gmail.com>
	<[email protected]>

Gotcha, it wasn't clear to me that this was never guaranteed. I will change
the type of this column to text to resolve this.

Appreciate the quick response!

Regards,
Marcelo

On Wed, May 13, 2026 at 10:51 AM Tom Lane <[email protected]> wrote:

> 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:  Re: pg_get_indexdef() output not idempotent for partial indexes with ALL(ARRAY[…])::text[]
  In-Reply-To: <CANKisB3F+=yZm-gK1RzcD761qUT56JT0LVOwe84Zg-QqBHZc3w@mail.gmail.com>

* 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