aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_dump/pg_dump.c')
-rw-r--r--src/bin/pg_dump/pg_dump.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index ae8d54936f1..637af90d91c 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.454 2006/12/23 00:43:12 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.455 2006/12/30 21:21:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -5007,11 +5007,15 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
char *typoutput;
char *typreceive;
char *typsend;
+ char *typmodin;
+ char *typmodout;
char *typanalyze;
Oid typinputoid;
Oid typoutputoid;
Oid typreceiveoid;
Oid typsendoid;
+ Oid typmodinoid;
+ Oid typmodoutoid;
Oid typanalyzeoid;
char *typdelim;
char *typbyval;
@@ -5024,15 +5028,35 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
selectSourceSchema(tinfo->dobj.namespace->dobj.name);
/* Fetch type-specific details */
- if (fout->remoteVersion >= 80000)
+ if (fout->remoteVersion >= 80300)
{
appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, typreceive, typsend, "
+ "typmodin, typmodout, typanalyze, "
+ "typinput::pg_catalog.oid as typinputoid, "
+ "typoutput::pg_catalog.oid as typoutputoid, "
+ "typreceive::pg_catalog.oid as typreceiveoid, "
+ "typsend::pg_catalog.oid as typsendoid, "
+ "typmodin::pg_catalog.oid as typmodinoid, "
+ "typmodout::pg_catalog.oid as typmodoutoid, "
+ "typanalyze::pg_catalog.oid as typanalyzeoid, "
+ "typdelim, typbyval, typalign, typstorage, "
+ "pg_catalog.pg_get_expr(typdefaultbin, 'pg_catalog.pg_type'::pg_catalog.regclass) as typdefaultbin, typdefault "
+ "FROM pg_catalog.pg_type "
+ "WHERE oid = '%u'::pg_catalog.oid",
+ tinfo->dobj.catId.oid);
+ }
+ else if (fout->remoteVersion >= 80000)
+ {
+ appendPQExpBuffer(query, "SELECT typlen, "
+ "typinput, typoutput, typreceive, typsend, "
+ "'-' as typmodin, '-' as typmodout, "
"typanalyze, "
"typinput::pg_catalog.oid as typinputoid, "
"typoutput::pg_catalog.oid as typoutputoid, "
"typreceive::pg_catalog.oid as typreceiveoid, "
"typsend::pg_catalog.oid as typsendoid, "
+ "0 as typmodinoid, 0 as typmodoutoid, "
"typanalyze::pg_catalog.oid as typanalyzeoid, "
"typdelim, typbyval, typalign, typstorage, "
"pg_catalog.pg_get_expr(typdefaultbin, 'pg_catalog.pg_type'::pg_catalog.regclass) as typdefaultbin, typdefault "
@@ -5044,11 +5068,13 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
{
appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, typreceive, typsend, "
+ "'-' as typmodin, '-' as typmodout, "
"'-' as typanalyze, "
"typinput::pg_catalog.oid as typinputoid, "
"typoutput::pg_catalog.oid as typoutputoid, "
"typreceive::pg_catalog.oid as typreceiveoid, "
"typsend::pg_catalog.oid as typsendoid, "
+ "0 as typmodinoid, 0 as typmodoutoid, "
"0 as typanalyzeoid, "
"typdelim, typbyval, typalign, typstorage, "
"pg_catalog.pg_get_expr(typdefaultbin, 'pg_catalog.pg_type'::pg_catalog.regclass) as typdefaultbin, typdefault "
@@ -5061,10 +5087,12 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, "
"'-' as typreceive, '-' as typsend, "
+ "'-' as typmodin, '-' as typmodout, "
"'-' as typanalyze, "
"typinput::pg_catalog.oid as typinputoid, "
"typoutput::pg_catalog.oid as typoutputoid, "
"0 as typreceiveoid, 0 as typsendoid, "
+ "0 as typmodinoid, 0 as typmodoutoid, "
"0 as typanalyzeoid, "
"typdelim, typbyval, typalign, typstorage, "
"pg_catalog.pg_get_expr(typdefaultbin, 'pg_catalog.pg_type'::pg_catalog.regclass) as typdefaultbin, typdefault "
@@ -5081,10 +5109,12 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, "
"'-' as typreceive, '-' as typsend, "
+ "'-' as typmodin, '-' as typmodout, "
"'-' as typanalyze, "
"typinput::oid as typinputoid, "
"typoutput::oid as typoutputoid, "
"0 as typreceiveoid, 0 as typsendoid, "
+ "0 as typmodinoid, 0 as typmodoutoid, "
"0 as typanalyzeoid, "
"typdelim, typbyval, typalign, typstorage, "
"NULL as typdefaultbin, typdefault "
@@ -5101,10 +5131,12 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, "
"'-' as typreceive, '-' as typsend, "
+ "'-' as typmodin, '-' as typmodout, "
"'-' as typanalyze, "
"typinput::oid as typinputoid, "
"typoutput::oid as typoutputoid, "
"0 as typreceiveoid, 0 as typsendoid, "
+ "0 as typmodinoid, 0 as typmodoutoid, "
"0 as typanalyzeoid, "
"typdelim, typbyval, typalign, typstorage, "
"NULL as typdefaultbin, NULL as typdefault "
@@ -5117,10 +5149,12 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, "
"'-' as typreceive, '-' as typsend, "
+ "'-' as typmodin, '-' as typmodout, "
"'-' as typanalyze, "
"typinput::oid as typinputoid, "
"typoutput::oid as typoutputoid, "
"0 as typreceiveoid, 0 as typsendoid, "
+ "0 as typmodinoid, 0 as typmodoutoid, "
"0 as typanalyzeoid, "
"typdelim, typbyval, typalign, "
"'p'::char as typstorage, "
@@ -5147,11 +5181,15 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
typoutput = PQgetvalue(res, 0, PQfnumber(res, "typoutput"));
typreceive = PQgetvalue(res, 0, PQfnumber(res, "typreceive"));
typsend = PQgetvalue(res, 0, PQfnumber(res, "typsend"));
+ typmodin = PQgetvalue(res, 0, PQfnumber(res, "typmodin"));
+ typmodout = PQgetvalue(res, 0, PQfnumber(res, "typmodout"));
typanalyze = PQgetvalue(res, 0, PQfnumber(res, "typanalyze"));
typinputoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typinputoid")));
typoutputoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typoutputoid")));
typreceiveoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typreceiveoid")));
typsendoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typsendoid")));
+ typmodinoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typmodinoid")));
+ typmodoutoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typmodoutoid")));
typanalyzeoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typanalyzeoid")));
typdelim = PQgetvalue(res, 0, PQfnumber(res, "typdelim"));
typbyval = PQgetvalue(res, 0, PQfnumber(res, "typbyval"));
@@ -5193,6 +5231,10 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
appendPQExpBuffer(q, ",\n RECEIVE = %s", typreceive);
if (OidIsValid(typsendoid))
appendPQExpBuffer(q, ",\n SEND = %s", typsend);
+ if (OidIsValid(typmodinoid))
+ appendPQExpBuffer(q, ",\n TYPMOD_IN = %s", typmodin);
+ if (OidIsValid(typmodoutoid))
+ appendPQExpBuffer(q, ",\n TYPMOD_OUT = %s", typmodout);
if (OidIsValid(typanalyzeoid))
appendPQExpBuffer(q, ",\n ANALYZE = %s", typanalyze);
}
@@ -5202,7 +5244,7 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
/* cannot combine these because fmtId uses static result area */
appendPQExpBuffer(q, ",\n INPUT = %s", fmtId(typinput));
appendPQExpBuffer(q, ",\n OUTPUT = %s", fmtId(typoutput));
- /* no chance that receive/send/analyze need be printed */
+ /* receive/send/typmodin/typmodout/analyze need not be printed */
}
if (typdefault != NULL)