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.

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De           | Use PostgreSQL!

Fri, 21 Jan 2000 15:11:32 +0100
Michael Meskes <meskes@postgresql.org>
Types
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)

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

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "He that giveth unto the poor shall not lack..."       
                         Proverbs 28:27 



Sat, 22 Jan 2000 10:56:19 +0000
"Oliver Elphick" <olly@lfix.co.uk>
Re: [HACKERS] Types 
On Sat, Jan 22, 2000 at 10:56:19AM +0000, Oliver Elphick wrote:
> If the type is 1007, then:
> 
> template1=> select typname from pg_type where oid = 1007;
> typname
> -------
> _int4  
> (1 row)
> 
> If the typename begins with an underscore, it is an array type.

Thanks.

Michael

-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De           | Use PostgreSQL!

Sat, 22 Jan 2000 14:53:09 +0100
Michael Meskes <meskes@postgresql.org>
Re: [HACKERS] Types
"Oliver Elphick" <olly@lfix.co.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

Sat, 22 Jan 2000 11:09:36 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Types 