Automatic PK values not added to new rows

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Automatic PK values not added to new rows
Дата
Msg-id e4a17cde-9941-5eb5-e88d-246577e4488c@appl-ecosys.com
обсуждение исходный текст
Ответы Re: Automatic PK values not added to new rows  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: Automatic PK values not added to new rows  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
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



В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: "Join Postgres on Slack" ?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Automatic PK values not added to new rows