On 09/30/11 1:28 AM, John R Pierce wrote:
> On 09/30/11 1:23 AM, John R Pierce wrote:
>> convert the fields to bigint which are 64 bit and not likely to wrap
>> around any time in this century
>
> indeed, this is as simple as ...
>
> alter table tblname alter column id type bigint;
>
> of course, you'll need to alter all the FK fields that refer to it
> too, and I don't know if that entangles this.
>
>
yes, quite easy.
test=# create table xxx (id serial primary key, val text);
NOTICE: CREATE TABLE will create implicit sequence "xxx_id_seq" for
serial column "xxx.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"xxx_pkey" for table "xxx"
CREATE TABLE
test=# create table yyy (id serial primary key, xxx_id int references
xxx(id));
NOTICE: CREATE TABLE will create implicit sequence "yyy_id_seq" for
serial column "yyy.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"yyy_pkey" for table "yyy"
CREATE TABLE
test=# alter table xxx alter column id type bigint;
ALTER TABLE
test=# alter table yyy alter column xxx_id type bigint;
ALTER TABLE
voila!
--
john r pierce N 37, W 122
santa cruz ca mid-left coast