Re: Index (primary key) corrupt?

2025-10-11 Thread Greg Sabino Mullane
On Sat, Sep 20, 2025 at 5:07 AM Wim Rouquart  wrote:

> Name   |Value  |
> ---+---+
> indexrelid |2006873|
> indrelid   |1998823|
> indnatts   |1  |
> indnkeyatts|1  |

...

indclass   |{} |
>

Hold on, that makes no sense at all. The indkey/indclass columns cannot be
empty, especially as indnkeyatts is 1, as it should be. As a matter of
fact, pg_dump would completely choke on a broken table like this and not
even be able to dump it. But that output is clearly not from psql, so I
think whatever client application you are using is not able to reliably
output array columns. Any chance you can run that select command using
psql? As the rest of the columns look sane, I'm going to guess those are as
well, they just don't show up correctly, and the system catalogs are
uncorrupted.

until I do the rebuild and then the issue is fixed


Could you show us exactly the steps that show the index is missing, and
that it is then fixed?

(ponders) Keep in mind that although you declared the primary key in your
create table statement, pg_dump is going to separate the table creation
from the primary key creation by a lot of lines. So you will see in the
pg_dump output:

CREATE TABLE public.bcf_work_type (
id bigint NOT NULL,
aml_score bigint NOT NULL
);

and then much later on:

ALTER TABLE ONLY public.bcf_work_type
ADD CONSTRAINT idx_376814_primary PRIMARY KEY (id);

Also be aware that if you are using the --section argument, the table will
appear in the 'pre-data' section but the primary key will appear in the
'post-data' section.


Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support


Re: Upgrade & Rollback plan: My customer requests rollback via old-version standby (13 ↔ 17) — need community advice

2025-10-11 Thread Bruce Momjian
On Sat, Oct 11, 2025 at 08:16:42PM +0200, Laurenz Albe wrote:
> On Sat, 2025-10-11 at 23:02 +0700, Vu Le (JData - HN) wrote:
> > If possible, could you please share any additional best practices or
> > important considerations apart from testing the new version in a
> > staging environment?
> 
> All I can think of is:
> 
> - Always keep a backup around.
> 
> - Read the "Migration to version x" section of the release notes of v14,
>   v15, v16 and v17 before you test the application.  That will give you
>   ideas what areas to test particularly well.
> 
> - Test your administrative procedures too.  For example, v15 removed
>   the exclusive online file system backup.

Agreed, and this might help for reviewing the release notes:

https://momjian.us/main/blogs/pgblog/2022.html#June_13_2022

-- 
  Bruce Momjian  https://momjian.us
  EDB  https://enterprisedb.com

  Do not let urgent matters crowd out time for investment in the future.