agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Tom Lane <tgl@sss.pgh.pa.us>
To: Tchouante, Merlin <mtchouan@umaryland.edu>
Cc: pgsql-sql@lists.postgresql.org <pgsql-sql@lists.postgresql.org>
Subject: Re: Returned row count doesn't match lines in output file
Date: Thu, 07 Nov 2019 13:06:31 -0500
Message-ID: <15359.1573149991@sss.pgh.pa.us> (raw)
In-Reply-To: <BL0PR12MB2562AE54C7A5A8A680421FC7D2780@BL0PR12MB2562.namprd12.prod.outlook.com>
References: <BL0PR12MB2562AE54C7A5A8A680421FC7D2780@BL0PR12MB2562.namprd12.prod.outlook.com>
"Tchouante, Merlin" <mtchouan@umaryland.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
view thread (5+ messages) latest in thread
Message-ID: <15359.1573149991@sss.pgh.pa.us>
Permalink: ../15359.1573149991@sss.pgh.pa.us/
Also on: postgresql.org/message-id/15359.1573149991@sss.pgh.pa.us
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, mtchouan@umaryland.edu, pgsql-sql@lists.postgresql.org
Subject: Re: Returned row count doesn't match lines in output file
In-Reply-To: <15359.1573149991@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox