From: | "Shoaib Mir" <shoaibmir(at)gmail(dot)com> |
---|---|
To: | "PostgreSQL General" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: 21 bit number for sequence |
Date: | 2006-04-18 11:32:49 |
Message-ID: | bf54be870604180432k3ea18571j8c753539a71d8f25@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks Dawid. I also used something similar to that kind of approach and its
working for me.
/Shoaib
On 4/18/06, Dawid Kuroczko <qnex42(at)gmail(dot)com> wrote:
>
> On 4/15/06, Shoaib Mir <shoaibmir(at)gmail(dot)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
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2006-04-18 11:49:11 | Re: Curious UDP packets |
Previous Message | Achilleus Mantzios | 2006-04-18 11:32:40 | Re: [SQL] Thoughts on a Isolation/Security problem. |