| От | Tom Lane |
|---|---|
| Тема | Re: [pgadmin-hackers] Fwd: Re: Howto change column |
| Дата | |
| Msg-id | 5693.1005158532@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: [pgadmin-hackers] Fwd: Re: Howto change column (Stephan Szabo <sszabo@megazone23.bigpanda.com>) |
| Список | pgsql-general |
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> For the text types I think it's generally length+4. For numeric, I think
> it's precision*65536+scale. The best way to find out is probably to
> declare a column of the target type and check.
Or experiment with format_type(), or read the source code for same.
For example:
regression=# select oid from pg_type where typname = 'numeric';
oid
------
1700
(1 row)
regression=# select format_type(1700, 10 * 65536 + 7);
format_type
---------------
numeric(10,3)
(1 row)
Looks like there's an offset of 4 for numeric, too. But a look into
src/backend/utils/adt/format_type.c gives the exact recipe ...
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера