Re: Technical validation on altering atttypmod for numeric column in PostgreSQL

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Holger Jakobs <holger(at)jakobs(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Technical validation on altering atttypmod for numeric column in PostgreSQL
Date: 2026-03-23 13:57:37
Message-ID: 4b3b47cbf91c31767d99222a9a849827f7e01620.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, 2026-03-23 at 14:47 +0100, Holger Jakobs wrote:
> > UPDATE pg_attribute SET atttypmod = (18 << 16 | 4) + 4 WHERE attrelid = 'table'::regclass  AND attname  = 'column';
> >
> >   Is this approach considered safe from a data integrity
> >   perspective?
>
> this change can lead to problems, because numbers with more than 16 digits before the decimal
> point wouldn't fit into the new data type.

Aww, right.
Goes to show how dangerous such operations are.

Yours,
Laurenz Albe

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2026-03-23 13:57:57 Re: Technical validation on altering atttypmod for numeric column in PostgreSQL
Previous Message Laurenz Albe 2026-03-23 13:55:40 Re: Technical validation on altering atttypmod for numeric column in PostgreSQL