Re: Reset sequence to current maximum value of rows

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Reset sequence to current maximum value of rows
Date: 2024-06-13 20:14:56
Message-ID: CAKFQuwb-msDns_5FNvpakoW1GNksejZPApMw05eNQtuwnQiMYw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 13, 2024 at 12:57 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:

> INSERT into companies (company_nbr,company_name,industry,status) VALUES
> (DEFAULT,'A new company name', 'Manufacturing',DEFAULT);
>
> Yesterday, before learning to use DEFAULT for the company_nbr PK I entered
> all rows using company_nbr 2342-2391. This morning, after running the
> single-line INSERT command company numbers from 2341-2392 all had 'A new
> company name' as the company_name.
>
>
There is no way, in the absence of a user trigger, that the above insert
command changed pre-existing rows. And if you cannot reproduce the
behavior you claim to have seen I will continue to just assume you have
faulty memory.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Casey & Gina 2024-06-13 20:18:30 Re: Question about UNIX socket connections and SSL
Previous Message Rich Shepard 2024-06-13 20:09:51 Re: Reset sequence to current maximum value of rows