Re: Returned row count doesn't match lines in output file

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Tchouante, Merlin" <mtchouan(at)umaryland(dot)edu>
Cc: "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: Returned row count doesn't match lines in output file
Date: 2019-11-07 18:06:31
Message-ID: 15359.1573149991@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Tchouante, Merlin" <mtchouan(at)umaryland(dot)edu> writes:
> I'm executing an .sql file which looks like this:

> \o /home/bbuser/banner/gradeload/sodorgusers.txt
> \t on
> select u.user_id||'|'||u.firstname||'|'||u.lastname||'|'||u.email||'|'||u.student_id
> from users u, course_main cm, course_users cu
> where cu.crsmain_pk1 = cm.pk1
> and cu.users_pk1 = u.pk1
> and cm.course_id = 'Org.dent.Training'
> order by u.lastname, u.firstname;
> \t off
> \o

> When I look at the output file, it has a bunch of blank lines in between the records but displays a line count of 4916. What is causing the blank lines?

Null values in one or more of the columns you're concatenating, perhaps?
Concatenating a null with something else yields null. (See
coalesce() for one ad-hoc way to fix that.)

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rob Sargent 2019-11-07 18:06:33 Re: Returned row count doesn't match lines in output file
Previous Message Tchouante, Merlin 2019-11-07 17:57:16 Returned row count doesn't match lines in output file