Unix Technical Forum

Data type display

This is a discussion on Data type display within the pgsql Interfaces Pgadmin Hackers forums, part of the PostgreSQL category; --> Is there a reason why pgAdmin uses internal type names like int2 everywhere, whereas the supposedly user-friendly approach would ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces Pgadmin Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 06:57 PM
Peter Eisentraut
 
Posts: n/a
Default Data type display

Is there a reason why pgAdmin uses internal type names like int2 everywhere,
whereas the supposedly user-friendly approach would be that external names
like smallint should be used. (Compare to the output of psql and pg_dump.)
You can obtain the friendly name using the backend function format_type,
which has been available at least since 7.3. This would also avoid the need
for manual concatenating with "[]" for array types.

Also, the lists of data types you get when creating a table are not sorted
very well. The beginning seems to be alphabetical, but the geometry types
are at the end.

Perhaps, as an interface improvement, remove all the array types from the list
but instead make a separate checkbox "Array" instead.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 06:57 PM
Andreas Pflug
 
Posts: n/a
Default Re: Data type display

Peter Eisentraut wrote:
> Is there a reason why pgAdmin uses internal type names like int2 everywhere,
> whereas the supposedly user-friendly approach would be that external names
> like smallint should be used. (Compare to the output of psql and pg_dump.)
> You can obtain the friendly name using the backend function format_type,
> which has been available at least since 7.3. This would also avoid the need
> for manual concatenating with "[]" for array types.


I wasn't aware of that function back those days...


> Also, the lists of data types you get when creating a table are not sorted
> very well. The beginning seems to be alphabetical, but the geometry types
> are at the end.
>
> Perhaps, as an interface improvement, remove all the array types from the list
> but instead make a separate checkbox "Array" instead.


pgAdmin uses the following query when retrieving valid types:

SELECT
typname, t.oid, CASE WHEN typelem > 0 THEN typelem ELSE t.oid END as
elemoid, typlen, typtype, nspname,
FROM pg_type t
JOIN pg_namespace nsp ON typnamespace=nsp.oid
WHERE typisdefined
AND typtype IN ('b', 'd')
ORDER BY CASE WHEN typtype='d' THEN 0 ELSE 1 END,
(t.typelem>0)::bool,
t.typname

serial and bigserial are added 'manually' if appropriate.

The goal was to have the types grouped: domain first, standard types
next, then array types.

I'm not too happy about the combobox at all, it's much too big. I'd
really like some hierarchical selection method, maybe a combobox with a
dropdown tree instead of a list. Wanted to implement this for ages now...

Regards,
Andreas



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:13 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com