diff options
author | Bruce Momjian <bruce@momjian.us> | 1999-05-13 02:35:44 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1999-05-13 02:35:44 +0000 |
commit | 519ad246ae377bfa2f30a3854545b5c184119b9c (patch) | |
tree | b87fddb45d477f8ce17a4dd49cc7f1f90e9e6c3b | |
parent | 0b885e2397c695b6cf7db8c4f93f5272706e1672 (diff) | |
download | postgresql-519ad246ae377bfa2f30a3854545b5c184119b9c.tar.gz postgresql-519ad246ae377bfa2f30a3854545b5c184119b9c.zip |
Here's a small patch to cause pg_dump to emit the
scale and precision for NUMERIC type column defs.
Keith Parks
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 4ec2171dad2..a7b77ef41e5 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -21,7 +21,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.105 1999/05/10 00:46:18 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.106 1999/05/13 02:35:44 momjian Exp $ * * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * @@ -2671,6 +2671,10 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables, 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) @@ -2749,6 +2753,18 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables, 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; * Let's make sure we force it through with quotes. * - thomas 1998-12-13 |