Re: Definging columns for INSERT statements

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: Definging columns for INSERT statements
Date: 2024-06-12 22:12:53
Message-ID: CAKFQuwbpWc97huJPbQSQ_F1JoEk+X_3KTbSDGdv+8ueUhktO+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jun 12, 2024 at 2:11 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:

> I have > 100 rows to add to a table using INSERT INTO statements. I want
> the
> PK to be the next value in the sequence. Would this be the appropriate
> syntax for the columns to be entered?
>

The whole point of the server is to parse text and tell you if it has
syntax errors and then, if not, execute what you gave it.

> INSERT INTO people (person_nbr
> DEFAULT('people_person_nbr_seq'),lname,fname,job_title DEFAULT
> 'Contact',company_nbr,loc_nbr,direct_phone,cell_phone,email,active
> DEFAULT('true')) VALUES
>

https://www.postgresql.org/docs/current/sql-insert.html

Not sure where you got the idea that something besides a plain column name
can appear in the optional parentheses after the table name.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2024-06-12 22:41:14 Re: UPDATE with multiple WHERE conditions
Previous Message David G. Johnston 2024-06-12 22:09:57 Re: UPDATE with multiple WHERE conditions