Patch to pg_dump for NUMERIC.
| От | Keith Parks |
|---|---|
| Тема | Patch to pg_dump for NUMERIC. |
| Дата | |
| Msg-id | 199905121927.UAA27868@mtcc.demon.co.uk обсуждение исходный текст |
| Ответы |
Re: [PATCHES] Patch to pg_dump for NUMERIC.
|
| Список | pgsql-hackers |
Here's a small patch to cause pg_dump to emit the
scale and precision for NUMERIC type column defs.
Keith.
*** src/bin/pg_dump/pg_dump.c.orig Mon May 10 22:19:09 1999
--- src/bin/pg_dump/pg_dump.c Wed May 12 11:26:35 1999
***************
*** 2671,2676 ****
--- 2671,2680 ---- char **parentRels; /* list of names of parent relations */ int
numParents; int actual_atts; /* number of attrs in this CREATE statment */
+ int32 tmp_typmod;
+ int precision;
+ int scale;
+ /* First - dump SEQUENCEs */ if (tablename)
***************
*** 2747,2752 ****
--- 2751,2768 ---- { sprintf(q + strlen(q), "(%d)",
tblinfo[i].atttypmod[j] - VARHDRSZ);
+ }
+ }
+ else if (!strcmp(tblinfo[i].typnames[j], "numeric"))
+ {
+ sprintf(q + strlen(q), "numeric");
+ if (tblinfo[i].atttypmod[j] != -1)
+ {
+ tmp_typmod = tblinfo[i].atttypmod[j] - VARHDRSZ;
+ precision = (tmp_typmod >> 16) & 0xffff;
+ scale = tmp_typmod & 0xffff;
+ sprintf(q + strlen(q), "(%d,%d)",
+ precision, scale); } }
/* char is an internal single-byte data type;
В списке pgsql-hackers по дате отправления: