Re: Technical validation on altering atttypmod for numeric column in PostgreSQL - Mailing list pgsql-admin

From Laurenz Albe
Subject Re: Technical validation on altering atttypmod for numeric column in PostgreSQL
Date
Msg-id 4b3b47cbf91c31767d99222a9a849827f7e01620.camel@cybertec.at
Whole thread Raw
In response to Re: Technical validation on altering atttypmod for numeric column in PostgreSQL  (Holger Jakobs <holger@jakobs.com>)
List 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



pgsql-admin by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Technical validation on altering atttypmod for numeric column in PostgreSQL
Next
From: Tom Lane
Date:
Subject: Re: Technical validation on altering atttypmod for numeric column in PostgreSQL