Re: Multiple tables row insertions from single psql input file

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: Multiple tables row insertions from single psql input file
Date: 2024-06-10 22:00:55
Message-ID: CAKFQuwZGsnB680tLxDyrkDoz-BNesF=s1xL1CCGsieLK=5P1Vg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jun 10, 2024 at 2:58 PM Rich Shepard <rshepard(at)appl-ecosys(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2024-06-10 22:35:58 Re: Multiple tables row insertions from single psql input file [RESOLVED]
Previous Message Rich Shepard 2024-06-10 21:58:42 Re: Multiple tables row insertions from single psql input file