From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Rich Shepard <rshepard(at)appl-ecosys(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Definging columns for INSERT statements |
Date: | 2024-06-12 23:38:54 |
Message-ID: | 9288042e-9cd3-4121-ab99-459f0fac9f53@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 6/12/24 16:24, Rich Shepard wrote:
> On Wed, 12 Jun 2024, Adrian Klaver wrote:
>
>> Assuming 'people_person_nbr_seq' is the sequence attached to person_nbr
>> and the other DEFAULTs are the column defaults then the syntax would be:
>>
>> INSERT INTO people
>> (person_nbr, lname, fname, job_title, company_nbr,loc_nbr,
>> direct_phone, cell_phone,email, active)
>> VALUES
>> (DEFAULT, 'klaver', 'adrian', DEFAULT, 1, 1, '555-1234', '555-4321',
>> 'adrian(dot)klaver(at)aklaver(dot)com', DEFAULT);
>>
>> If they are not the column defaults then just supply the literal value.
>
> Adrian,
>
> No matter how many postgres docs and web pages I read I didn't find an
> example as explicit as yours. Columns other than the person_nbr were not
> defined with defaults and I expected to enter them for each row.
The 'Examples' section at the bottom of this page:
https://www.postgresql.org/docs/current/sql-insert.html
is a useful resource.
>
> Many thanks for another valuable lesson.
>
> Best regards,
>
> Rich
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Dragan Milivojević | 2024-06-13 00:54:29 | Is NVMe RAID useless (performance-wise) with PostgreSQL? |
Previous Message | Rich Shepard | 2024-06-12 23:24:56 | Re: Definging columns for INSERT statements |