Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iSmBd-0001vf-5T for pgsql-sql@arkaria.postgresql.org; Thu, 07 Nov 2019 18:07:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iSmBb-0002AQ-Q2 for pgsql-sql@arkaria.postgresql.org; Thu, 07 Nov 2019 18:07:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iSmB5-0008OX-Gp for pgsql-sql@lists.postgresql.org; Thu, 07 Nov 2019 18:06:39 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iSmB3-0006Bb-0m for pgsql-sql@lists.postgresql.org; Thu, 07 Nov 2019 18:06:38 +0000 Received: by mail-pl1-x635.google.com with SMTP id l4so2001433plt.13 for ; Thu, 07 Nov 2019 10:06:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=HkGn8ykzYDj6RgnYw2PxgxoQJVXEdNd1M62iTXgj1nk=; b=tdR3SnjpMH/U2dxmD5UWg2u425DDA0fRK08Wn/Bbg5rsWo27HOK4GYaXtuERWOfFOS kP2q6CzfWA6SzrwSg7yOS1iWTb83mPB13rFbWjnbhknawQZ0E5CTGan1WP5PBrQxyeL7 DkJDwkqOGI0CfkcXjJsKnt/A5/e9DBtclQ6WMSYIXEZ/LZkJ8DGTPJXUV50AYf/czmWQ +yN3+fHkgGOwZWA3eebQv0aH0aA0CILaMJWnkm+MLQ29C8y54PdobjVg5w/VvgyMbvAh fB/iR82QnXo4dqHSzaJLpS2grd1MnNOaMGhZvvu0WAseJh0rSr4fc48rua+PRzY9U6EZ qMYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=HkGn8ykzYDj6RgnYw2PxgxoQJVXEdNd1M62iTXgj1nk=; b=IaKtO77sWIq95zP9QQ6VzDTi2VY+h92UdN3gkYkiHrxp2P5s0hEEwWXWUayMol4UPJ jiW6Jauy/rUfFh5FKwYA6uqDeUhmkiglm/mAwbhQ94A3oz6RkvlJERgjKKlqW0vOxL2P J4CTmcdm7ycfOXQvplPms1j/B/aW0sAILGTpLbrLZrZrTF+hFakRSbodPoPCDby9sD4D iWS/vgC0MoiJjB4+cn5Li5b8x7H6/IXul99uKkYsVC0RVGPRr3eo2KzxNk7e8JALmH98 1Ig4Iq67ABLM8vJMtH+G9bpCUe1rdQut7xB51y/LWbCx0Ge2IAMF0YwBiCodeHNh5Q00 Fa/A== X-Gm-Message-State: APjAAAWv/NSkpAqyaBJ75pBdyC7vSXfhY9tMmX1vDRd5FSLa4eMYFyC6 ut9PVtxOg91MdZA/UtC8xD5RzP6w X-Google-Smtp-Source: APXvYqyH3R2lbZYSRvEP7KI4IU+6LzRSkwdcygvhqZ27IdJCQSblRcTM0CA835ttVyNfMc0GxfKvCQ== X-Received: by 2002:a17:90a:2e81:: with SMTP id r1mr6889848pjd.64.1573149995978; Thu, 07 Nov 2019 10:06:35 -0800 (PST) Received: from [10.106.130.95] ([155.100.47.7]) by smtp.gmail.com with ESMTPSA id f8sm3772986pgd.64.2019.11.07.10.06.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Nov 2019 10:06:35 -0800 (PST) From: Rob Sargent Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_8F6A6E58-DA4D-476B-B104-D932E560247E" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: Returned row count doesn't match lines in output file Date: Thu, 7 Nov 2019 11:06:33 -0700 In-Reply-To: Cc: "pgsql-sql@lists.postgresql.org" To: "Tchouante, Merlin" References: X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_8F6A6E58-DA4D-476B-B104-D932E560247E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Nov 7, 2019, at 10:57 AM, Tchouante, Merlin = wrote: >=20 > Hello group, > =20 > I=E2=80=99m new to this group so please bear with me. > =20 > =20 > select count (u.user_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'; > =20 > (4915 rows) > =20 > =20 > I=E2=80=99m executing an .sql file which looks like this: > =20 > \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 > =20 > 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=E2=80=99t all 4,915 records writing to the file? > =20 Are there any null values in any of the fields you=E2=80=99re = concatenating? Try the same query but return the separate columns. = Maybe add \pset null nil to get other than whitespace for null. > =20 > Any and all help would be greatly appreciated. > =20 > Thanks, > -- Merlin > =20 > =20 > Merlin D. Tchouante, Sr. IT Enterprise Application Developer > Center for Information Technology Services (CITS)=20 > 601 West Lombard Street=20 > Baltimore, Maryland 21201-1512=20 > mtchouan@umaryland.edu =20 > 410-706-4489 * 410-706-1500 fax > =20 > Please send Blackboard questions to the CITS support email address: = DL-CITSBbSupport@umaryland.edu > Please send Mediasite questions to the CITS support email address: = DL-CITSMediasiteSupport@umaryland.edu = > =20 > --Apple-Mail=_8F6A6E58-DA4D-476B-B104-D932E560247E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Nov 7, 2019, at 10:57 AM, Tchouante, Merlin <mtchouan@umaryland.edu> wrote:

Hello = group,
 
I=E2=80=99m 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 =3D cm.pk1
and cu.users_pk1 =3D u.pk1
and cm.course_id =3D = 'Org.dent.Training';
 
(4915 rows)
 
 
I=E2=80=99m 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?  When I strip away the blank lines from = the file, I get 3525 lines.  Why aren=E2=80=99t all 4,915 records = writing to the file?
 

Are there any null values in any of the fields you=E2=80=99= re concatenating?  Try the same query but return the separate = columns.  Maybe add \pset null nil to get other than whitespace for = null.

 
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@umaryland.edu  
410-706-4489 * 410-706-1500 fax
 
Please send Blackboard questions to the CITS support email = address:  DL-CITSBbSupport@umaryland.edu
Please send Mediasite questions to the CITS support email = address:  DL-CITSMediasiteSupport@umaryland.edu
 
<image001.jpg>

= --Apple-Mail=_8F6A6E58-DA4D-476B-B104-D932E560247E--