Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 519ad24

Browse files
committed
Here's a small patch to cause pg_dump to emit the
scale and precision for NUMERIC type column defs. Keith Parks
1 parent 0b885e2 commit 519ad24

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.105 1999/05/10 00:46:18 momjian Exp $
24+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.106 1999/05/13 02:35:44 momjian Exp $
2525
*
2626
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2727
*
@@ -2671,6 +2671,10 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
26712671
char **parentRels; /* list of names of parent relations */
26722672
int numParents;
26732673
int actual_atts; /* number of attrs in this CREATE statment */
2674+
int32 tmp_typmod;
2675+
int precision;
2676+
int scale;
2677+
26742678

26752679
/* First - dump SEQUENCEs */
26762680
if (tablename)
@@ -2749,6 +2753,18 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
27492753
tblinfo[i].atttypmod[j] - VARHDRSZ);
27502754
}
27512755
}
2756+
else if (!strcmp(tblinfo[i].typnames[j], "numeric"))
2757+
{
2758+
sprintf(q + strlen(q), "numeric");
2759+
if (tblinfo[i].atttypmod[j] != -1)
2760+
{
2761+
tmp_typmod = tblinfo[i].atttypmod[j] - VARHDRSZ;
2762+
precision = (tmp_typmod >> 16) & 0xffff;
2763+
scale = tmp_typmod & 0xffff;
2764+
sprintf(q + strlen(q), "(%d,%d)",
2765+
precision, scale);
2766+
}
2767+
}
27522768
/* char is an internal single-byte data type;
27532769
* Let's make sure we force it through with quotes.
27542770
* - thomas 1998-12-13

0 commit comments

Comments
 (0)