Re: Increasing a NUMERIC column precision doesn't cause a table rewrite. Why?
| От | Tom Lane |
|---|---|
| Тема | Re: Increasing a NUMERIC column precision doesn't cause a table rewrite. Why? |
| Дата | |
| Msg-id | 329227.1762187472@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Increasing a NUMERIC column precision doesn't cause a table rewrite. Why? (Marcelo Fernandes <marcefern7@gmail.com>) |
| Список | pgsql-general |
Marcelo Fernandes <marcefern7@gmail.com> writes: > After doing some playing around with different operations against a numeric > column, namely: increasing/decreasing the precision or increasing/decreasing > the scale, I noticed that the table is rewritten in all cases except when > increasing the precision number. Yup. > For example, is there a catalog table I can have a look to see how these values > are defined, along with some form of documentation to understand how they are > interpreted by Postgres? You'd have to look into the source code: https://github.com/postgres/postgres/blob/c4067383cb2c155c4cfea2351036709e2ebb3535/src/backend/utils/adt/numeric.c The first few hundred lines of numeric.c are largely comments that you'd find relevant. Also see numeric_support(): https://github.com/postgres/postgres/blob/c4067383cb2c155c4cfea2351036709e2ebb3535/src/backend/utils/adt/numeric.c#L1179 ALTER TABLE skips table rewrite if the datatype conversion expression is simplified to a no-op by a support function such as numeric_support. regards, tom lane
В списке pgsql-general по дате отправления: