Re: stored procs

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: stored procs
Дата
Msg-id 4E85819A.6070607@hogranch.com
обсуждение исходный текст
Ответ на Re: stored procs  (John R Pierce <pierce@hogranch.com>)
Ответы Re: stored procs
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: stored procs
Следующее
От: Gregg Jaskiewicz
Дата:
Сообщение: Re: Rules going away