From: Rich Shepard <rshepard@appl-ecosys.com>
To: pgsql-general@lists.postgresql.org
Subject: Automatic PK values not added to new rows
Date: Wed, 25 May 2022 10:43:14 -0700 (PDT)
Message-ID: <e4a17cde-9941-5eb5-e88d-246577e4488c@appl-ecosys.com> (raw)
The People table has 965 rows; the table structure is:
Table "public.people"
Column | Type | Collation | Nullable | Default
---------------+-----------------------+-----------+----------+-------------------------------------
person_nbr | integer | | not null | nextval('people_person_nbr_seq'::reg
class)
lname | character varying(32) | | not null | '??'::character varying
fname | character varying(15) | | not null | '??'::character varying
job_title | character varying(48) | | |
company_nbr | integer | | |
loc_nbr | integer | | not null | 1
loc_phone_ext | character varying(32) | | |
direct_phone | character varying(15) | | |
direct_fax | character varying(15) | | |
cell_phone | character varying(15) | | |
email | character varying(64) | | |
active | boolean | | not null | true
comment | text | | |
Indexes:
"people_pkey" PRIMARY KEY, btree (person_nbr)
Foreign-key constraints:
"people_org_nbr_fkey" FOREIGN KEY (company_nbr) REFERENCES companies(company_nbr) ON UPDATE CASC
ADE ON DELETE RESTRICT
I'm trying to insert 15 new rows to that table by inserting all columns
except the first one.. Psql tells me:
psql:insert_into_people.sql:16: ERROR: duplicate key value violates unique constraint "people_pkey"
DETAIL: Key (person_nbr)=(683) already exists.
person_nbr 683 is not in any row to be inserted.
I was under the impression that the person_nbr for the new rows would start
with 966 but that's apparently not happening.
What have I missed?
Rich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: rshepard@appl-ecosys.com
Subject: Re: Automatic PK values not added to new rows
In-Reply-To: <e4a17cde-9941-5eb5-e88d-246577e4488c@appl-ecosys.com>
References: <e4a17cde-9941-5eb5-e88d-246577e4488c@appl-ecosys.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox