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

From: Steve Midgley <science(at)misuse(dot)org>
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:38
Message-ID: CAJexoSL0CJ-VY7Nhfv1Yrg6b4h2Pd=Nsb+QdYTH-s_=YbjJy2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Nov 7, 2019 at 9:58 AM Tchouante, Merlin <mtchouan(at)umaryland(dot)edu>
wrote:

> 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?
>
>
>
>
>
If you just run a simple select on user_id (none of the pipe concat stuff)
from the file, what results do you get? Also if you run the count statement
from the file, what results do you get? (Just want to make sure you're not
accidentally running against a different server, database or default schema
as the source of the problem..)

Steve

In response to

Browse pgsql-sql by date

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