psql \x bug - Mailing list pgsql-patches

From Greg Sabino Mullane
Subject psql \x bug
Date
Msg-id b269154cb63027bd44a43d0b07cb3113@biglumber.com
Whole thread Raw
Responses Re: psql \x bug
List pgsql-patches
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message


Fix two instances of using raw "puts" inside of specifying fout.
The second one caused a bug that can be seen by using the pager
in expanded output mode:

$ psql pgtest

pgtest> \x
Expanded display is on.
pgtest> SELECT * FROM pg_class LIMIT 2;

(messy output)

--
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200509161020
https://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8


Index: print.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/print.c,v
retrieving revision 1.72
diff -c -r1.72 print.c
*** print.c     18 Jul 2005 20:57:53 -0000      1.72
--- print.c     16 Sep 2005 14:18:04 -0000
***************
*** 570,576 ****

        if (cells[0] == NULL)
        {
!               puts(_("(No rows)\n"));
                return;
        }

--- 570,576 ----

        if (cells[0] == NULL)
        {
!               fprintf(fout, _("(No rows)\n"));
                return;
        }

***************
*** 704,710 ****
                        if (opt_align[i % col_count] == 'r' && opt_numeric_locale)
                            format_numeric_locale(my_cell);
                        if (opt_border < 2)
!                               puts(my_cell);
                        else
                                fprintf(fout, "%-s%*s |\n", my_cell, dwidth - cell_w[i], "");
                        free(my_cell);
--- 704,710 ----
                        if (opt_align[i % col_count] == 'r' && opt_numeric_locale)
                            format_numeric_locale(my_cell);
                        if (opt_border < 2)
!                               fprintf(fout, "%s\n", my_cell);
                        else
                                fprintf(fout, "%-s%*s |\n", my_cell, dwidth - cell_w[i], "");
                        free(my_cell);
-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAkMq1REACgkQvJuQZxSWSsjIGgCeIE1CONuRu31KZuJLAcNZT1VI
sysAoK6Pi5NXYPBC/0oNhmQKqZqca5jw
=W9GE
-----END PGP SIGNATURE-----



pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: small changes to autovacuum maintainance
Next
From: "Michael Paesold"
Date:
Subject: Bug in psql (on_error_rollback)