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 19:35:01 |
Message-ID: | CAKFQuwY4PXdUYWxWzZ+idD64GLA2vrKf_UDcSPf=5VuYSDNRUA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Jun 13, 2024 at 11:24 AM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:
> On Thu, 13 Jun 2024, David G. Johnston wrote:
>
> > You need to show your work here. As your PK is a number it cannot have a
> > company name as a value and so this doesn't make sense.
>
> insert into companies (company_nbr,company_name,industry,status) values
> (DEFAULT,'new company name','Industry','Opportunity')
>
> With DEFAULT as the company_nbr why can't the company_name not have a
> value?
>
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.
> > If you use the default when inserting the next value in the sequence is
> > used.
>
> Yes, that's the theory. It didn't work for me and why it didn't is what I
> want to understand.
>
>
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 J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-06-13 19:39:30 | Re: Reserving GUC prefixes from a non-preloaded DB extension is not always enforced |
Previous Message | Narek Galstyan | 2024-06-13 19:26:00 | Reserving GUC prefixes from a non-preloaded DB extension is not always enforced |