Re: how to create an index on serial column
Posted in 1995
Sally Woolrich <Sally@excelsis.demon.co.uk> wrote:
>In article <41l8co$rtu@eccdb1.pms.ford.com>
> mreed@ese721 "Michael Reed - Radiix" writes:
>
>> Steve Morrow (smorrow@dotrisc.cfr.usf.edu) wrote:
>> : A unique index is automatically built on a serial column.
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> This is not true.
>> A serial column doesn't guarantee uniqueness. An index is not auto-
>> matically built.
>>
>> The only way to guarantee uniqueness is to build a unique index
>> on that column. I can't answer why alter table is giving him trouble, though.
>
>I think that it *is* true that each value in a serial column is unique,
>but it is *not* true that there is an index unless you explicitly
>build one - certainly if using 'CREATE TABLE' statements to create
>a table (there is another way of creating them hidden *somewhere*
>in the 'dbaccess/'isql' ring menu structures).
>
>--
>============================================================================
>Sally Woolrich | This mail contains my personal
>sally@excelsis.demon.co.uk | views not those of my employer!
>============================================================================
The Table created with dbaccess has a unique constraint
automatically added.
'create table ...' does not.
The SERIAL will still be unique as long as 2^31 rows are not exceeded,
then there is a wrap-around (This assuming you don't mess around with
'alter table' to reset the 'next' value, or set it in the 'create ..').
This quotes the Manual T 9-9 Version 7.1.
I hope this is true
Andreas Zeugswetter