char *typbyval;
char *typalign;
char *typstorage;
+ char *typcollatable;
char *typdefault;
bool typdefault_is_literal = false;
selectSourceSchema(tyinfo->dobj.namespace->dobj.name);
/* Fetch type-specific details */
- if (fout->remoteVersion >= 80400)
+ if (fout->remoteVersion >= 90100)
+ {
+ 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, "
+ "typcategory, typispreferred, "
+ "typdelim, typbyval, typalign, typstorage, "
+ "(typcollation = (SELECT oid FROM pg_catalog.pg_collation WHERE collname = 'default')) AS typcollatable, "
+ "pg_catalog.pg_get_expr(typdefaultbin, 0) AS typdefaultbin, typdefault "
+ "FROM pg_catalog.pg_type "
+ "WHERE oid = '%u'::pg_catalog.oid",
+ tyinfo->dobj.catId.oid);
+ }
+ else if (fout->remoteVersion >= 80400)
{
appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, typreceive, typsend, "
"typanalyze::pg_catalog.oid AS typanalyzeoid, "
"typcategory, typispreferred, "
"typdelim, typbyval, typalign, typstorage, "
+ "false AS typcollatable, "
"pg_catalog.pg_get_expr(typdefaultbin, 0) AS typdefaultbin, typdefault "
"FROM pg_catalog.pg_type "
"WHERE oid = '%u'::pg_catalog.oid",
"typanalyze::pg_catalog.oid AS typanalyzeoid, "
"'U' AS typcategory, false AS typispreferred, "
"typdelim, typbyval, typalign, typstorage, "
+ "false AS typcollatable, "
"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",
"typanalyze::pg_catalog.oid AS typanalyzeoid, "
"'U' AS typcategory, false AS typispreferred, "
"typdelim, typbyval, typalign, typstorage, "
+ "false AS typcollatable, "
"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",
"0 AS typanalyzeoid, "
"'U' AS typcategory, false AS typispreferred, "
"typdelim, typbyval, typalign, typstorage, "
+ "false AS typcollatable, "
"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",
"0 AS typanalyzeoid, "
"'U' AS typcategory, false AS typispreferred, "
"typdelim, typbyval, typalign, typstorage, "
+ "false AS typcollatable, "
"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",
"0 AS typanalyzeoid, "
"'U' AS typcategory, false AS typispreferred, "
"typdelim, typbyval, typalign, typstorage, "
+ "false AS typcollatable, "
"NULL AS typdefaultbin, typdefault "
"FROM pg_type "
"WHERE oid = '%u'::oid",
"0 AS typanalyzeoid, "
"'U' AS typcategory, false AS typispreferred, "
"typdelim, typbyval, typalign, typstorage, "
+ "false AS typcollatable, "
"NULL AS typdefaultbin, NULL AS typdefault "
"FROM pg_type "
"WHERE oid = '%u'::oid",
"'U' AS typcategory, false AS typispreferred, "
"typdelim, typbyval, typalign, "
"'p'::char AS typstorage, "
+ "false AS typcollatable, "
"NULL AS typdefaultbin, NULL AS typdefault "
"FROM pg_type "
"WHERE oid = '%u'::oid",
typbyval = PQgetvalue(res, 0, PQfnumber(res, "typbyval"));
typalign = PQgetvalue(res, 0, PQfnumber(res, "typalign"));
typstorage = PQgetvalue(res, 0, PQfnumber(res, "typstorage"));
+ typcollatable = PQgetvalue(res, 0, PQfnumber(res, "typcollatable"));
if (!PQgetisnull(res, 0, PQfnumber(res, "typdefaultbin")))
typdefault = PQgetvalue(res, 0, PQfnumber(res, "typdefaultbin"));
else if (!PQgetisnull(res, 0, PQfnumber(res, "typdefault")))
/* receive/send/typmodin/typmodout/analyze need not be printed */
}
+ if (strcmp(typcollatable, "t") == 0)
+ appendPQExpBuffer(q, ",\n COLLATABLE = true");
+
if (typdefault != NULL)
{
appendPQExpBuffer(q, ",\n DEFAULT = ");