public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Rich Shepard <[email protected]>
Cc: [email protected]
Subject: Re: Multiple tables row insertions from single psql input file
Date: Mon, 10 Jun 2024 15:00:55 -0700
Message-ID: <CAKFQuwZGsnB680tLxDyrkDoz-BNesF=s1xL1CCGsieLK=5P1Vg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>

On Mon, Jun 10, 2024 at 2:58 PM Rich Shepard <[email protected]>
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.


view thread (3+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Multiple tables row insertions from single psql input file
  In-Reply-To: <CAKFQuwZGsnB680tLxDyrkDoz-BNesF=s1xL1CCGsieLK=5P1Vg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox