Skip site navigation (1) Skip section navigation (2)

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 (view raw, whole thread or download thread mbox)
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            Sweden


pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group