Updating of serial ID fields - Mailing list pgsql-novice

From Lan Barnes
Subject Updating of serial ID fields
Date
Msg-id 20060719204613.GA24974@falleagle.net
Whole thread Raw
Responses Re: Updating of serial ID fields
List pgsql-novice
I have defined several tables with a field names "id" that is type
serial-not null-primary index. Here is a partial dump:

CREATE TABLE builds (
    id serial NOT NULL,
    dev_label character varying(25),
    build_label character varying(25),
    build_category character varying(15),
    sw_delta_build text,
    request_date date,
    delivery_date date,
    scm_remarks text,
    requester character varying(25),
    build_reason text,
    build_number character varying(5),
    code_line character varying(25),
    unit_test_results text,
    change_lists_submitted text,
    lines_of_code character varying(8),
    build_logs text,
    special_instructions text,
    build_status character varying(10),
    scm_builder character varying(15)
);

The field in question is the first field.

I have written front ends in Tcl/Tk (using pgtcl) to, among other
things, insert records. Originally, I added logic to get the last value
on this field, increment it, and then insert the new value. However, I
noticed that this happened whether or not I added the logic, so I
stopped doing that.

Now after several iterations, I find that this is no longer happening.
Also, even though the dumps still list these fields as serial, pgaccess
now says they're int4.

I have done several schema saves, db drops, and schema restores. Did I
lose something?

I figured these fields were getting updated as automatic triggers. I
need them to stay consistent for internal integrity. How do I best do
this?

TIA,

--
Lan Barnes
Linux Guy, SCM Specialist
Tcl/Tk Enthusiast

No matter how good you feel, if four friends tell you you're drunk,
you'd better lie down.
                             - Theodore Sorensen


pgsql-novice by date:

Previous
From: "Gregory Amato"
Date:
Subject: Installation error
Next
From: Richard Broersma Jr
Date:
Subject: Re: Updating of serial ID fields