Re: Multiple tables row insertions from single psql input file - Mailing list pgsql-general

From David G. Johnston
Subject Re: Multiple tables row insertions from single psql input file
Date
Msg-id CAKFQuwZGsnB680tLxDyrkDoz-BNesF=s1xL1CCGsieLK=5P1Vg@mail.gmail.com
Whole thread Raw
In response to Re: Multiple tables row insertions from single psql input file  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Multiple tables row insertions from single psql input file [RESOLVED]
List pgsql-general
On Mon, Jun 10, 2024 at 2:58 PM Rich Shepard <rshepard@appl-ecosys.com> wrote:

INSERT into companies (company_nbr,company_name,industry,status) VALUES
nextval('companies_org_nbr_seq'),'Acme','Manufacturing','Opportunity'),
nextval('companies_org_nbr_seq'),'Baker','Livestock','Opportunity');

Running:
$ psql -U rshepard -d bustrac -f test-script.sql
psql:test-script.sql:3: ERROR:  syntax error at or near "nextval"
LINE 2: nextval('companies_org_nbr_seq'),'Acme','Manufacturing','Opp...
         ^
What have I missed?


Values introduces literal records/rows.  Rows are written within parentheses.
Values (..., ...), (..., ...)

You seem to have the closing parenthesis but not the opening one.

David J.

pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Re: Multiple tables row insertions from single psql input file
Next
From: Rich Shepard
Date:
Subject: Re: Multiple tables row insertions from single psql input file [RESOLVED]