From: | ries van Twisk <pg(at)rvt(dot)dds(dot)nl> |
---|---|
To: | Peter Billen <peter(at)clueless(dot)be> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: SERIAL datatype |
Date: | 2008-08-21 19:29:04 |
Message-ID: | 7045176E-65D4-4721-AC86-1B3F179199A9@rvt.dds.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Aug 21, 2008, at 2:23 PM, Peter Billen wrote:
> Oops, my example was a bit incorrectly edited.
>
> I wanted to say that the range of a serial datatype goes from 1 to 5
> (incluse) and I insert five entries (not 10).
>
> Peter
>
> Peter Billen schreef:
>> Hi all,
>>
>> I would like to ask a question about the serial datatype. Say I
>> have a field of type serial, and say for the sake of example that
>> the range of a serial goes from 1 to 5 (inclusive). I insert 10
>> entries into the table, so the table is 'full':
>>
>> INSERT INTO my_table (my_serial) VALUES (DEFAULT);
>> INSERT INTO my_table (my_serial) VALUES (DEFAULT);
>> INSERT INTO my_table (my_serial) VALUES (DEFAULT);
>> INSERT INTO my_table (my_serial) VALUES (DEFAULT);
>>
>> Next I delete a random entry, say the one with value 3:
>>
>> DELETE FROM my_table WHERE my_serial = 3;
>>
>> Is it possible to insert a new entry? Will the serial sequence
>> somehow be able to find the gap (3)?
>>
>> The reason why I am asking is because I have a table in which
>> constantly entries are being deleted and inserted. What happens if
>> the serial sequence is exhausted? If it is not able to go the the
>> next gap, how is it possible to keep inserting and deleting entries
>> once the serial sequence has been exhausted? I can't find this
>> anywhere in docs.
>>
>> To me, it is perfectly possible that there is only one entry in the
>> table, with a serial value equal to its upper limit.
>>
>> Thanks in advance. Kind regards,
>>
>> Peter
>>
May be you want to use BIGSERIAL if you are worried?
Ries
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
From | Date | Subject | |
---|---|---|---|
Next Message | c k | 2008-08-21 19:48:51 | Query performance difference |
Previous Message | Peter Billen | 2008-08-21 19:23:51 | Re: SERIAL datatype |