Returned row count doesn't match lines in output file

From: "Tchouante, Merlin" <mtchouan(at)umaryland(dot)edu>
To: "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Returned row count doesn't match lines in output file
Date: 2019-11-07 17:57:16
Message-ID: BL0PR12MB2562AE54C7A5A8A680421FC7D2780@BL0PR12MB2562.namprd12.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello group,

I'm new to this group so please bear with me.

select count (u.user_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';

(4915 rows)

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? When I strip away the blank lines from the file, I get 3525 lines. Why aren't all 4,915 records writing to the file?

Any and all help would be greatly appreciated.

Thanks,
-- Merlin

Merlin D. Tchouante, Sr. IT Enterprise Application Developer
Center for Information Technology Services (CITS)
601 West Lombard Street
Baltimore, Maryland 21201-1512
mtchouan(at)umaryland(dot)edu<mailto:mtchouan(at)umaryland(dot)edu>
410-706-4489 * 410-706-1500 fax

Please send Blackboard questions to the CITS support email address: DL-CITSBbSupport(at)umaryland(dot)edu<mailto:dl-citsbbsupport(at)umaryland(dot)edu>
Please send Mediasite questions to the CITS support email address: DL-CITSMediasiteSupport(at)umaryland(dot)edu<mailto:DL-CITSMediasiteSupport(at)umaryland(dot)edu>

[New UMB Logo]

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2019-11-07 18:06:31 Re: Returned row count doesn't match lines in output file
Previous Message Rene Romero Benavides 2019-11-07 00:53:12 Re: Using transactions in all CRUD operations