pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: lukas.eder@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18660: information_schema.columns.ordinal_position has gaps when primary key columns are dropped
Date: Thu, 17 Oct 2024 10:19:15 -0400
Message-ID: <650059.1729174755@sss.pgh.pa.us> (raw)
In-Reply-To: <18660-9ea9b58cce21a8bb@postgresql.org>
References: <18660-9ea9b58cce21a8bb@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> [ information_schema.columns.ordinal_position is just a copy of attnum ]

> This is against the SQL standard specification of the
> information_schema.columns.ordinal_position column, which has a constraint
> as follows:

> CONSTRAINT COLUMNS_ORDINAL_POSITION_CONTIGUOUS_CHECK CHECK (0 = ALL (
>   SELECT MAX(ORDINAL_POSITION) - COUNT(*)
>   FROM COLUMNS
>   GROUP BY
>   TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME 
> ))

Hm.  I'm not sure if it's worth making that view even slower in order
to clean up the numbering.  Just as an aside, we'd still be violating
the letter of this constraint, because for a zero-column table the
sub-select will produce NULL not 0.

If we ever complete the fabled project to split up logical and
physical attnums, we would presumably be able to fix this without
slowing down the view, since we'd want it to report logical attnums
anyway.  I don't have high hopes for that happening though ...

			regards, tom lane





view thread (3+ messages)  latest in thread

Message-ID: <650059.1729174755@sss.pgh.pa.us>
Permalink:  ../650059.1729174755@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/650059.1729174755@sss.pgh.pa.us

 · 

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: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, lukas.eder@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18660: information_schema.columns.ordinal_position has gaps when primary key columns are dropped
  In-Reply-To: <650059.1729174755@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox