Re: Returned row count doesn't match lines in output file
Tom Lane <[email protected]> Thu, 07 Nov 2019 13:06:31 -0500
| Newsgroups | gmane.comp.db.postgresql.sql |
|---|---|
| Message-ID | <[email protected]> |
"Tchouante, Merlin" <[email protected]> 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 =3D cm.pk1 > and cu.users_pk1 =3D u.pk1 > and cm.course_id =3D '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