pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Multi-row insert: error at terminal row. [RESOLVED]
10+ messages / 5 participants
[nested] [flat]
* Re: Multi-row insert: error at terminal row. [RESOLVED]
@ 2020-10-29 16:30 Rich Shepard <rshepard@appl-ecosys.com>
1 sibling, 0 replies; 10+ messages in thread
From: Rich Shepard @ 2020-10-29 16:30 UTC (permalink / raw)
To: PostgreSQL General <pgsql-general@lists.postgresql.org>
On Thu, 29 Oct 2020, Adrian Klaver wrote:
> Pretty sure the thinking is that the opening parenthesis is further upstream,
> say around VALUES?
Well, duh! Of course. I forgot to enclose all value rows. Mea culpa!
Thanks,
Rich
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Multi-row insert: error at terminal row. [RESOLVED]
@ 2020-10-29 17:39 Rich Shepard <rshepard@appl-ecosys.com>
1 sibling, 3 replies; 10+ messages in thread
From: Rich Shepard @ 2020-10-29 17:39 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On Thu, 29 Oct 2020, Rich Shepard wrote:
> psql:organizations.sql:1926: ERROR: syntax error at or near ";"
> LINE 1925: ...m',null,'Port','Opportunity',null);
^
> I'm not seeing why that's an error. All previous rows terminate with a comma
> and I don't know where else to look for the reason. What am I missing
> seeing?
Rob/Paul/David/Tom/Adrian:
Found the problem in line 26 of 1925 rows: a non-null column had 'null'
entered rather than one of the allowed values. That row was in the original
database and I've no idea when I might have changed that.
Why postgres didn't highlight that until I had only a 50-line .sql file I
don't know. But, when bifircating the original file into smaller pieces and
I got down to 50 lines postgres showed me exactly what the error was:
psql:orgs-1.sql:50: ERROR: null value in column "industry" violates
not-null constraint.
Does this happen in newer versions than the 12.2 installed here?
Whew!
Stay well all ... and VOTE!
Rich
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Multi-row insert: error at terminal row. [RESOLVED]
@ 2020-10-29 17:42 Tom Lane <tgl@sss.pgh.pa.us>
parent: Rich Shepard <rshepard@appl-ecosys.com>
2 siblings, 0 replies; 10+ messages in thread
From: Tom Lane @ 2020-10-29 17:42 UTC (permalink / raw)
To: Rich Shepard <rshepard@appl-ecosys.com>; +Cc: pgsql-general@lists.postgresql.org
Rich Shepard <rshepard@appl-ecosys.com> writes:
> Found the problem in line 26 of 1925 rows: a non-null column had 'null'
> entered rather than one of the allowed values. That row was in the original
> database and I've no idea when I might have changed that.
> Why postgres didn't highlight that until I had only a 50-line .sql file I
> don't know. But, when bifircating the original file into smaller pieces and
> I got down to 50 lines postgres showed me exactly what the error was:
> psql:orgs-1.sql:50: ERROR: null value in column "industry" violates
> not-null constraint.
> Does this happen in newer versions than the 12.2 installed here?
That seems a bit odd. You're doing this in psql? Can you show
an exact example where the error report goes missing?
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Multi-row insert: error at terminal row. [RESOLVED]
@ 2020-10-29 17:45 David G. Johnston <david.g.johnston@gmail.com>
parent: Rich Shepard <rshepard@appl-ecosys.com>
2 siblings, 0 replies; 10+ messages in thread
From: David G. Johnston @ 2020-10-29 17:45 UTC (permalink / raw)
To: Rich Shepard <rshepard@appl-ecosys.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Thu, Oct 29, 2020, 10:39 Rich Shepard <rshepard@appl-ecosys.com> wrote:
> On Thu, 29 Oct 2020, Rich Shepard wrote:
>
> > psql:organizations.sql:1926: ERROR: syntax error at or near ";"
> > LINE 1925: ...m',null,'Port','Opportunity',null);
> ^
> > I'm not seeing why that's an error. All previous rows terminate with a
> comma
> > and I don't know where else to look for the reason. What am I missing
> > seeing?
>
> Rob/Paul/David/Tom/Adrian:
>
> Found the problem in line 26 of 1925 rows: a non-null column had 'null'
> entered rather than one of the allowed values. That row was in the original
> database and I've no idea when I might have changed that.
>
> Why postgres didn't highlight that until I had only a 50-line .sql file I
> don't know. But, when bifircating the original file into smaller pieces and
> I got down to 50 lines postgres showed me exactly what the error was:
>
> psql:orgs-1.sql:50: ERROR: null value in column "industry" violates
> not-null constraint.
>
> Does this happen in newer versions than the 12.2 installed here?
>
I think you found a second problem...covered up by the first, which
prevented the insert from even progressing to the point where a constraint
violation could be encountered. I.e., your original error is syntax.
David J.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Multi-row insert: error at terminal row. [RESOLVED]
@ 2020-10-29 17:46 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Rich Shepard <rshepard@appl-ecosys.com>
2 siblings, 1 reply; 10+ messages in thread
From: Adrian Klaver @ 2020-10-29 17:46 UTC (permalink / raw)
To: Rich Shepard <rshepard@appl-ecosys.com>; pgsql-general@lists.postgresql.org
On 10/29/20 10:39 AM, Rich Shepard wrote:
> On Thu, 29 Oct 2020, Rich Shepard wrote:
>
>> psql:organizations.sql:1926: ERROR: syntax error at or near ";"
>> LINE 1925: ...m',null,'Port','Opportunity',null);
> ^
>> I'm not seeing why that's an error. All previous rows terminate with a
>> comma
>> and I don't know where else to look for the reason. What am I missing
>> seeing?
>
> Rob/Paul/David/Tom/Adrian:
>
> Found the problem in line 26 of 1925 rows: a non-null column had 'null'
> entered rather than one of the allowed values. That row was in the original
> database and I've no idea when I might have changed that.
>
> Why postgres didn't highlight that until I had only a 50-line .sql file I
> don't know. But, when bifircating the original file into smaller pieces and
> I got down to 50 lines postgres showed me exactly what the error was:
>
> psql:orgs-1.sql:50: ERROR: null value in column "industry" violates
> not-null constraint.
>
> Does this happen in newer versions than the 12.2 installed here?
Per Tom's response, I'm not sure how a constraint error got transformed
into a syntax error?
Is orgs-1.sql just the INSERT?
How is that file being fed to psql?
>
> Whew!
>
> Stay well all ... and VOTE!
>
> Rich
>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Multi-row insert: error at terminal row. [RESOLVED]
@ 2020-10-29 17:52 Rich Shepard <rshepard@appl-ecosys.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 10+ messages in thread
From: Rich Shepard @ 2020-10-29 17:52 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On Thu, 29 Oct 2020, Adrian Klaver wrote:
> Is orgs-1.sql just the INSERT?
Yes.
> How is that file being fed to psql?
$ psql -d bustrac -f orgs-1.sql
Rich
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Multi-row insert: error at terminal row. [RESOLVED]
@ 2020-10-29 17:54 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Rich Shepard <rshepard@appl-ecosys.com>
0 siblings, 1 reply; 10+ messages in thread
From: Adrian Klaver @ 2020-10-29 17:54 UTC (permalink / raw)
To: Rich Shepard <rshepard@appl-ecosys.com>; pgsql-general@lists.postgresql.org
On 10/29/20 10:52 AM, Rich Shepard wrote:
> On Thu, 29 Oct 2020, Adrian Klaver wrote:
>
>> Is orgs-1.sql just the INSERT?
>
> Yes.
Is it just the 50 line version?
If it is, what happens if you go back to original 1925 line version and
correct the NULL issue in the line 26 and run it again?
>
>> How is that file being fed to psql?
>
> $ psql -d bustrac -f orgs-1.sql
>
> Rich
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Multi-row insert: error at terminal row. [RESOLVED]
@ 2020-10-29 20:07 Rich Shepard <rshepard@appl-ecosys.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 10+ messages in thread
From: Rich Shepard @ 2020-10-29 20:07 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On Thu, 29 Oct 2020, Adrian Klaver wrote:
> Is it just the 50 line version?
Adrian,
Nope.
> If it is, what happens if you go back to original 1925 line version and
> correct the NULL issue in the line 26 and run it again?
I'm finding typos and column tranposition errors that I had not spotted when
I checked my work. Now going through the file in small chunks and fixing
what broke.
Thanks,
Rich
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Multi-row insert: error at terminal row. [RESOLVED]
@ 2020-10-29 20:25 Rob Sargent <robjsargent@gmail.com>
parent: Rich Shepard <rshepard@appl-ecosys.com>
0 siblings, 1 reply; 10+ messages in thread
From: Rob Sargent @ 2020-10-29 20:25 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 10/29/20 2:07 PM, Rich Shepard wrote:
> On Thu, 29 Oct 2020, Adrian Klaver wrote:
>
>> Is it just the 50 line version?
>
> Adrian,
>
> Nope.
>
>> If it is, what happens if you go back to original 1925 line version
>> and correct the NULL issue in the line 26 and run it again?
>
> I'm finding typos and column tranposition errors that I had not spotted
> when
> I checked my work. Now going through the file in small chunks and fixing
> what broke.
>
> Thanks,
>
> Rich
>
>
Would it be rude to suggest that you re-visit how that file was made?
Seems you'll be in the same boat "next time".
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Multi-row insert: error at terminal row. [RESOLVED]
@ 2020-10-29 22:06 Rich Shepard <rshepard@appl-ecosys.com>
parent: Rob Sargent <robjsargent@gmail.com>
0 siblings, 0 replies; 10+ messages in thread
From: Rich Shepard @ 2020-10-29 22:06 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On Thu, 29 Oct 2020, Rob Sargent wrote:
> Would it be rude to suggest that you re-visit how that file was made?
> Seems you'll be in the same boat "next time".
Rob,
Part of the files was exported from the old version of the database. New
rows were from different text files, each with a different format, and all
needing to be parsed with data belonging to four different tables.
There won't be a 'next time' now that I've corrected the database structure.
All new information (once I get these tables correctly loaded) will be
one-at-a-time.
Manipulating 2K datasets over long hours and multiple days led me to make
errors I didn't catch at the time.
Regards,
Rich
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2020-10-29 22:06 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 16:30 ` Rich Shepard <rshepard@appl-ecosys.com>
2020-10-29 17:39 ` Rich Shepard <rshepard@appl-ecosys.com>
2020-10-29 17:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-10-29 17:45 ` David G. Johnston <david.g.johnston@gmail.com>
2020-10-29 17:46 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-10-29 17:52 ` Rich Shepard <rshepard@appl-ecosys.com>
2020-10-29 17:54 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-10-29 20:07 ` Rich Shepard <rshepard@appl-ecosys.com>
2020-10-29 20:25 ` Rob Sargent <robjsargent@gmail.com>
2020-10-29 22:06 ` Rich Shepard <rshepard@appl-ecosys.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox