Le 06/01/2010 19:50, Dave Page a écrit :
> On Wed, Jan 6, 2010 at 6:45 PM, Guillaume Lelarge
> <guilla...@lelarge.info> wrote:
>> The easy way to fix this is calling format_type in the query and giving
>> it the atttypmod column of pg_attribute. I can't find if there are
>> corner cases if I do this. Dave, do you know why there is a pgDatatype?
>> it seems redundant with format_type. And the latter seems to work well
>> whereas pgDatatype is surely wrong.
> 
> iirc, it was intended as a type formatting and caching mechanism, that
> can not only format individual types, but can be used to populate
> combo boxes and the like with sets of types/domains with minimal
> overhead. For example, some of the dialogues can have quite a few
> combos full of types on them, which are not always the same, and not
> necessarily cheap to populate.
> 

OK. I checked every call to format_type and I think only one need to be
modified. Here is a patch that fixes the issue. I'm not quite sure it
doesn't create new ones.


-- 
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com
diff --git a/pgadmin/schema/pgColumn.cpp b/pgadmin/schema/pgColumn.cpp
index f9264cf..00806f4 100644
--- a/pgadmin/schema/pgColumn.cpp
+++ b/pgadmin/schema/pgColumn.cpp
@@ -375,7 +375,7 @@ pgObject *pgColumnFactory::CreateObjects(pgCollection *coll, ctlTree *browser, c
         systemRestriction = wxT("\n   AND att.attnum > 0");
         
     wxString sql=
-        wxT("SELECT att.*, def.*, pg_catalog.pg_get_expr(def.adbin, def.adrelid) AS defval, CASE WHEN att.attndims > 0 THEN 1 ELSE 0 END AS isarray, format_type(ty.oid,NULL) AS typname, tn.nspname as typnspname, et.typname as elemtypname,\n")
+        wxT("SELECT att.*, def.*, pg_catalog.pg_get_expr(def.adbin, def.adrelid) AS defval, CASE WHEN att.attndims > 0 THEN 1 ELSE 0 END AS isarray, format_type(ty.oid,NULL) AS typname, format_type(ty.oid,att.atttypmod) AS displaytypname, tn.nspname as typnspname, et.typname as elemtypname,\n")
         wxT("  cl.relname, na.nspname, att.attstattarget, description, cs.relname AS sername, ns.nspname AS serschema,\n")
         wxT("  (SELECT count(1) FROM pg_type t2 WHERE t2.typname=ty.typname) > 1 AS isdup, indkey,\n")
         wxT("  CASE \n")
@@ -453,7 +453,7 @@ pgObject *pgColumnFactory::CreateObjects(pgCollection *coll, ctlTree *browser, c
             column->iSetRawTypename(dt.Name());
 
             column->iSetVarTypename(dt.FullName());
-            column->iSetQuotedTypename(dt.FullName());
+            column->iSetQuotedTypename(columns->GetVal(wxT("displaytypname")));
 
             column->iSetNotNull(columns->GetBool(wxT("attnotnull")));
             column->iSetQuotedFullTable(database->GetQuotedSchemaPrefix(columns->GetVal(wxT("nspname")))
-- 
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Reply via email to