pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7817: psql does not relate to footer settings in extended mode
3+ messages / 2 participants
[nested] [flat]

* BUG #7817: psql does not relate to footer settings in extended mode
@ 2013-01-20 10:33 emesika@redhat.com
  2013-09-10 01:16 ` Re: BUG #7817: psql does not relate to footer settings in extended mode Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 3+ messages in thread

From: emesika@redhat.com @ 2013-01-20 10:33 UTC (permalink / raw)
  To: pgsql-bugs

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 <user> -t --pset=footer=off <db>
3) No output is generated
4) run
psql -U <user> -t --pset=footer=off -x <db>
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




-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #7817: psql does not relate to footer settings in extended mode
  2013-01-20 10:33 BUG #7817: psql does not relate to footer settings in extended mode emesika@redhat.com
@ 2013-09-10 01:16 ` Bruce Momjian <bruce@momjian.us>
  2013-09-10 23:07   ` Re: BUG #7817: psql does not relate to footer settings in extended mode Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Bruce Momjian @ 2013-09-10 01:16 UTC (permalink / raw)
  To: emesika@redhat.com; +Cc: pgsql-bugs

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 <user> -t --pset=footer=off <db>
> 3) No output is generated
> 4) run
> psql -U <user> -t --pset=footer=off -x <db>
> 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  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachments:

footer.diff (text/x-diff, 622B) download 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; }
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: BUG #7817: psql does not relate to footer settings in extended mode
  2013-01-20 10:33 BUG #7817: psql does not relate to footer settings in extended mode emesika@redhat.com
  2013-09-10 01:16 ` Re: BUG #7817: psql does not relate to footer settings in extended mode Bruce Momjian <bruce@momjian.us>
@ 2013-09-10 23:07   ` Bruce Momjian <bruce@momjian.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2013-09-10 23:07 UTC (permalink / raw)
  To: emesika@redhat.com; +Cc: pgsql-bugs


Applied.

---------------------------------------------------------------------------

On Mon, Sep  9, 2013 at 09:16:05PM -0400, Bruce Momjian wrote:
> 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 <user> -t --pset=footer=off <db>
> > 3) No output is generated
> > 4) run
> > psql -U <user> -t --pset=footer=off -x <db>
> > 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  <bruce@momjian.us>        http://momjian.us
>   EnterpriseDB                             http://enterprisedb.com
> 
>   + It's impossible for everything to be true. +

> 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;
>   	}

> 
> -- 
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs


-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2013-09-10 23:07 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-01-20 10:33 BUG #7817: psql does not relate to footer settings in extended mode emesika@redhat.com
2013-09-10 01:16 ` Bruce Momjian <bruce@momjian.us>
2013-09-10 23:07   ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox