Re: [PATCHES] Patch to pg_dump for NUMERIC.

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Keith Parks <emkxp01(at)mtcc(dot)demon(dot)co(dot)uk>
Cc: hackers(at)postgreSQL(dot)org, patches(at)postgreSQL(dot)org
Subject: Re: [PATCHES] Patch to pg_dump for NUMERIC.
Date: 1999-05-13 02:34:38
Message-ID: 199905130234.WAA27395@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Applied.

> Here's a small patch to cause pg_dump to emit the
> scale and precision for NUMERIC type column defs.
>
> Keith.
Content-Description: pg_dump.c.patch

> *** 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;

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-05-13 02:44:39 Re: [HACKERS] backend dies suddenly after a lot of error messages
Previous Message Bruce Momjian 1999-05-13 02:29:29 Re: [HACKERS] backend dies suddenly after a lot of error messages