Re: 21 bit number for sequence

Поиск
Список
Период
Сортировка
От Dawid Kuroczko
Тема Re: 21 bit number for sequence
Дата
Msg-id 758d5e7f0604171344t8763dd1p20fd31105c1e0a5c@mail.gmail.com
обсуждение исходный текст
Ответ на Re: 21 bit number for sequence  ("Shoaib Mir" <shoaibmir@gmail.com>)
Ответы Re: 21 bit number for sequence  ("Shoaib Mir" <shoaibmir@gmail.com>)
Список pgsql-general
On 4/15/06, Shoaib Mir <shoaibmir@gmail.com> wrote:
Actually that is the application requirment to use 21 bit numbers as porting it from Oracle where it used to work.

Yeah now i have decided to use a numeric data type in a table and use that to write my own nextval and currval functions for that purpose.


Something like:
CREATE SEQUENCE some_id_seq;
CREATE TABLE foo (
    some_id bit(21) DEFAULT nextval('some_id_seq')::bit(21),
    t text
);
insert into foo(t) values ('a');
insert into foo(t) values ('bar');
insert into foo(t) values ('baz');
insert into foo(some_id,t) values ('100000000000000100000', 'uhh');
SELECT * FROM foo;
       some_id         t
--------------------- ---
000000000000000000001 a
000000000000000000010 bar
000000000000000000011 baz
100000000000000100000 uhh
(4 rows)

HTH, HAND. :)
   Regards,
         Dawid

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

Предыдущее
От: "William Leite Araújo"
Дата:
Сообщение: Re: plpgsql replication stored procedure
Следующее
От: felix@crowfix.com
Дата:
Сообщение: Re: Query runs fast or slow