summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2016-03-03 19:41:54 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2016-03-03 19:45:24 +0100
commitac2505632c96b2653aea2d65178053d1ad9430ef (patch)
treed71c345d1e142484d3ac8bf7e1fb27e541276201 /connectivity
parentf59136a2ed1e3eb01cc5b62c5a7da07c34cbdfae (diff)
tdf#92538 use proper schema name for type names
Change-Id: I7e428e4530765925bd35c7f4fcde7f95ceb12243
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.cxx22
1 files changed, 17 insertions, 5 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index 0c00c9a32692..92912e1ffeb2 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -2191,6 +2191,16 @@ static sal_Int32 getMaxScale( sal_Int32 dataType )
return ret;
}
+namespace
+{
+ OUString construct_full_typename(OUString ns, OUString tn)
+ {
+ if(ns == "pg_catalog")
+ return tn;
+ else
+ return ns + "." + tn;
+ }
+}
static void pgTypeInfo2ResultSet(
std::vector< std::vector<Any> > &vec,
@@ -2255,7 +2265,7 @@ static void pgTypeInfo2ResultSet(
row[CREATE_PARAMS] <<= OUString("length, scale");
}
- row[TYPE_NAME] <<= xRow->getString(1);
+ row[TYPE_NAME] <<= construct_full_typename(xRow->getString(6), xRow->getString(1));
row[DATA_TYPE] <<= OUString::number(dataType);
row[PRECISION] <<= OUString::number( precision );
sal_Int32 nullable = xRow->getBoolean(4) ?
@@ -2297,8 +2307,9 @@ static void pgTypeInfo2ResultSet(
"pg_type.typtype AS typtype," //2
"pg_type.typlen AS typlen," //3
"pg_type.typnotnull AS typnotnull," //4
- "pg_type.typname AS typname " //5
- "FROM pg_type "
+ "pg_type.typname AS typname, " //5
+ "pg_namespace.nspname as typns " //6
+ "FROM pg_type LEFT JOIN pg_namespace ON pg_type.typnamespace=pg_namespace.oid "
"WHERE pg_type.typtype = 'b' "
"OR pg_type.typtype = 'p'"
);
@@ -2312,8 +2323,9 @@ static void pgTypeInfo2ResultSet(
"t2.typtype AS typtype,"
"t2.typlen AS typlen,"
"t2.typnotnull AS typnotnull,"
- "t2.typname as realtypname "
- "FROM pg_type as t1 LEFT JOIN pg_type AS t2 ON t1.typbasetype=t2.oid "
+ "t2.typname as realtypname, "
+ "pg_namespace.nspname as typns "
+ "FROM pg_type as t1 LEFT JOIN pg_type AS t2 ON t1.typbasetype=t2.oid LEFT JOIN pg_namespace ON t1.typnamespace=pg_namespace.oid "
"WHERE t1.typtype = 'd'" );
pgTypeInfo2ResultSet( vec, rs );