Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VJCYu-0006CY-P7 for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Sep 2013 01:16:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VJCYu-00041i-80 for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Sep 2013 01:16:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VJCYt-00041b-91 for pgsql-bugs@postgresql.org; Tue, 10 Sep 2013 01:16:11 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VJCYo-0001DF-Pp for pgsql-bugs@postgresql.org; Tue, 10 Sep 2013 01:16:09 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1VJCYn-0006eY-8n; Mon, 09 Sep 2013 21:16:05 -0400 Date: Mon, 9 Sep 2013 21:16:05 -0400 From: Bruce Momjian To: emesika@redhat.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7817: psql does not relate to footer settings in extended mode Message-ID: <20130910011605.GD32173@momjian.us> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Dxnq1zWXvFF0Q93v" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.8 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jan 20, 2013 at 10:33:37AM +0000, emesika@redhat.com wrote: > The following bug has been logged on the website: > > Bug reference: 7817 > Logged by: Eli Mesika > Email address: emesika@redhat.com > PostgreSQL version: 9.1.7 > Operating system: Fedora 16 > Description: > > psql does not relate to footer settings in extended mode > Sometimes we need to run a sql command withot generating header and footer. > This can be done using the -t flag and --pset=footer=off > The problem is that the footer is still diaplyed even if it was set to off > if we use the extended mode for the query (-x flag) > > Steps to Reproduce: > 1) create a table without any data > for example > create table text(i int); > 2) run > psql -U -t --pset=footer=off > 3) No output is generated > 4) run > psql -U -t --pset=footer=off -x > 5) Output generated : "(No Rows)" > > Actual results: > psql does not honour the footer settings when output is defined to be in > Extended Mode > > Expected results: > psql should not generate any output is query has no results and -t and > --pset=footer=off were given This has been fixed in PG 9.3 (released today) for the specific options you supplied: $ psql -t --pset=footer=off test Default footer is off. psql (9.4devel) Type "help" for help. CREATE TABLE test (x INT); CREATE TABLE SELECT * FROM test; \x Expanded display is on. SELECT * FROM test; Unfortunately, this did not fix the more simple case where --pset=footer=off is specified, but not -t: $ psql --pset=footer=off test Default footer is off. psql (9.4devel) Type "help" for help. CREATE TABLE test (x INT); CREATE TABLE SELECT * FROM test; x --- \x Expanded display is on. SELECT * FROM test; --> (No rows) The attached patch fixes this, and makes it match the rest of the output formats, which do honor --pset=footer=off alone for footers. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + --Dxnq1zWXvFF0Q93v Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="footer.diff" diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c new file mode 100644 index 5589cea..736225c *** a/src/bin/psql/print.c --- b/src/bin/psql/print.c *************** print_aligned_vertical(const printTableC *** 1171,1177 **** if (cont->cells[0] == NULL && cont->opt->start_table && cont->opt->stop_table) { ! if (!opt_tuples_only) fprintf(fout, _("(No rows)\n")); return; } --- 1171,1177 ---- if (cont->cells[0] == NULL && cont->opt->start_table && cont->opt->stop_table) { ! if (!opt_tuples_only && cont->opt->default_footer) fprintf(fout, _("(No rows)\n")); return; } --Dxnq1zWXvFF0Q93v Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --Dxnq1zWXvFF0Q93v--