Re: postgres types - Mailing list pgsql-admin

From Peter Eisentraut
Subject Re: postgres types
Date
Msg-id Pine.LNX.4.21.0005080048580.442-100000@localhost.localdomain
Whole thread Raw
In response to Re: postgres types  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-admin
Bruce Momjian writes:

> OID should be an unsigned int.  Let us know if there are any problems.

The oid type is for storing oids, not arbitrary numbers. It might happen
to do that too, but it isn't designed for it. To get unsigned numbers use
a check contraint. Then everyone knows what's going on; don't rely on the
particulars of the implementation.

Anyway ...

peter=# create table foo (a oid, b text);
CREATE
peter=# insert into foo values (-1, 'zzz');
INSERT 18730 1
peter=# select * from foo;
 a  |  b
----+-----
 -1 | zzz
(1 row)


> > Can I have UNSIGNED integer in PostgreSQL ?
> > E.g. how should I describe type of field to have
> > full range of 32 bits? If I describe filed as INT4,

int8/bigint

> > I'll get SIGNED integer, insn't it?

Per SQL, all numbers are signed.


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


pgsql-admin by date:

Previous
From: Nicolas Huillard
Date:
Subject: RE: rules problem
Next
From: Marc Wrubleski
Date:
Subject: plpgsql cannot stat plpgsql.so