Hi,
You can also use a SEQUENCE which is unique and will add a PK constraint to
your field.
Not sure about the date thing because with sequence you would already have a
PK for that row ? A bit confused too ...
e.g.:
CREATE SEQUENCE main_cats_main_cat_id_seq
START 1
INCREMENT 1
MAXVALUE 9223372036854775807
MINVALUE 1
CACHE 1;
CREATE TABLE main_cats (
main_cat_id integer DEFAULT nextval('"main_cats_main_cat_id_seq"'::text)
NOT NULL,
lang_id integer NOT NULL,
main_cat_name text NOT NULL,
mc_order_nro smallint,
main_cat_show boolean NOT NULL,
sub_cats boolean NOT NULL,
last_mod timestamp without time zone
);
BR,
Aarni
On Saturday 03 January 2004 10:27, you wrote:
> If I create a table and assign the column type for what will be the primary
> key the value of "Serial", do I need to explicitly create an index in
> addition?
>
> I was thinking that a Serial, would automatically be a Unique Index
> wouldn't it? I also set that field to the primary key... does that ensure
> an index is created?
>
> Just a little confused...
>
> Also, while I am on the topic, does it do any good to create indexes on a
> timestamp field?
>
> Thanks in advance,
> Alan
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
--
Aarni Ruuhimäki, pj
Sukellusseura Vesikot r.y.
www.vesikot.fi
info@vesikot.fi
-------------------------------------------------
Microsoft should change into vacuum cleaner
business where people actually want products
that suck.
-------------------------------------------------
This is a bugfree broadcast to you from a linux system.
-------------------------------------------------
Viestissä mahdollisesti esitetyt mielipiteet
saattavat olla kirjoittajan henkilökohtaisia
näkemyksiä, eivätkä välttämättä edusta
Sukellusseura Vesikot r.y.:n virallista kantaa.