public inbox for [email protected]  
help / color / mirror / Atom feed
From: Rich Shepard <[email protected]>
To: [email protected]
Subject: Re: Reset sequence to current maximum value of rows
Date: Thu, 13 Jun 2024 12:57:19 -0700 (PDT)
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKFQuwY4PXdUYWxWzZ+idD64GLA2vrKf_UDcSPf=5VuYSDNRUA@mail.gmail.com>
References: <[email protected]>
	<CAKFQuwba=vb16vR47W0oo3SirkJ+UqLEg5j9-fqe+vm=0Q7_qw@mail.gmail.com>
	<[email protected]>
	<CAKFQuwY4PXdUYWxWzZ+idD64GLA2vrKf_UDcSPf=5VuYSDNRUA@mail.gmail.com>

On Thu, 13 Jun 2024, David G. Johnston wrote:

> Because you specified company_name in the column listing for the things
> you are inserting values for. So in column position 2 you must have a
> value than can be inserted into the company_name column. It is utterly
> immaterial how you specified the value for column position 1.

> We can't help you understand if you don't show a complete working example
> and ask a question in relation to that example.  I suggest you start from
> scratch, this time using scripts, so that your work is recorded and
> replayable.

David,

INSERT into companies (company_nbr,company_name,industry,status) VALUES
(DEFAULT,'A new company name', 'Manufacturing',DEFAULT);

I always write scrips for SQL, R, GRASS, Python, bash. Above is a redacted
version of the single name I tried adding to the companies table.

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.

HTH,

Rich






view thread (10+ messages)  latest in thread

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Reset sequence to current maximum value of rows
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox