Dumping SQL type names

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Dumping SQL type names
Date: 2000-07-04 19:57:52
Message-ID: Pine.LNX.4.21.0007042122020.3542-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

A while ago I suggested to create a backend internal function that takes
an internal type name and an atttypmod and formats it to a canonical SQL
type, to be used by pg_dump, psql, and anyone who feels like it.

I have it written now, here's an example of how it works. Any comments?

regression=# select c.relname, a.attname, format_type(t.typname, a.atttypmod)
from pg_class c, pg_attribute a, pg_type t
where c.oid=a.attrelid and t.oid=a.atttypid
and c.relname not like 'pg\_%' and a.attnum > 0
order by 1;

relname | attname | format_type
-------------------------+---------------+------------------------
a | aa | text
a_star | class | character(1)
a_star | aa | integer
a_star | a | text
abstime_tbl | f1 | abstime
aggtest | a | smallint
aggtest | b | real
arrtest | a | smallint[]
arrtest | b | integer[]
arrtest | c | name[]
arrtest | d | text[]
arrtest | e | double precision[]
arrtest | f | character(5)[]
arrtest | g | character varying(5)[]
b | aa | text
...

--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-07-04 19:58:06 Re: [COMMITTERS] pgsql/doc/TODO.detail (alpha default distinct flock fsync function limit null pg_shadow primary)
Previous Message Peter Eisentraut 2000-07-04 19:57:37 Re: Memory-context slinging