Re: [HACKERS] Types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
Cc: Michael Meskes <meskes(at)postgreSQL(dot)org>, PostgreSQL Hacker <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Types
Date: 2000-01-22 16:09:36
Message-ID: 20545.948557376@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Oliver Elphick" <olly(at)lfix(dot)co(dot)uk> writes:
> Michael Meskes wrote:
>> libpq gives back the internal typenumbers of the attributes. How do I know
>> which number means which type? I need to find out if the type is an array.

> If the type is 1007, then:

> template1=> select typname from pg_type where oid = 1007;
> typname
> -------
> _int4
> (1 row)

Right...

> If the typename begins with an underscore, it is an array type.

If you are going to the trouble of looking in pg_type, then you
shouldn't rely on the convention that array type names begin with
underscores. What you *should* do is look at the typelem field.
If that's zero, it's not an array; if nonzero, it is an array type
(and typelem gives the OID of the array elements' type).

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-01-22 16:11:25 Re: [HACKERS] Re: vacuum timings
Previous Message Peter Eisentraut 2000-01-22 14:24:36 Re: [HACKERS] Status on 7.0