Re: Reset sequence to current maximum value of rows
От | Adrian Klaver |
---|---|
Тема | Re: Reset sequence to current maximum value of rows |
Дата | |
Msg-id | 53fd6cec-935e-415a-9267-07a3d43e498f@aklaver.com обсуждение исходный текст |
Ответ на | Re: Reset sequence to current maximum value of rows (Rich Shepard <rshepard@appl-ecosys.com>) |
Список | pgsql-general |
On 6/13/24 15:13, Rich Shepard wrote: > On Thu, 13 Jun 2024, Adrian Klaver wrote: > >> Not with: >> >> Table "public.companies" >> >> [...] >> Indexes: >> "organizations_pkey" PRIMARY KEY, btree (company_nbr) >> >> That would throw duplicate key errors. >> >> Are you sure that you did not do this on the contacts table as the >> company FK back to companies? > > Adrian, > > Yes, I'm sure. Early yesterday I did get duplicate key errors. That's > when I > looked on stackexchange to learn how to reset the sequence's max value to > the value of the number of rows in the table. Not only did my attempt to > add > a single new company to the companies table change all company names in > that > one industry to the new name, but I just discovered that it changed all > rows > in that column to the new company name: BEGIN; <Run query> <Check query results> Then either ROLLBACK; COMMIT; depending on the result of check. > > Regards, > > Rich > > -- Adrian Klaver adrian.klaver@aklaver.com
В списке pgsql-general по дате отправления: