[PATCHES] psql \x bug

2005-09-16 Thread Greg Sabino Mullane

-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 [EMAIL PROTECTED]
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 -  1.72
--- print.c 16 Sep 2005 14:18:04 -
***
*** 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-



---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[PATCHES] Bug in psql (on_error_rollback)

2005-09-16 Thread Michael Paesold
There is a bug in psql for the new ON_ERROR_ROLLBACK feature. In AUTOCOMMIT 
off mode it does not work correctly for the first statement.


This is how it works usually:

postgres=# \set AUTOCOMMIT off
postgres=# \set ON_ERROR_ROLLBACK interactive
postgres=# SELECT 1;
?column?
--
   1
(1 row)

postgres=# SELECT a;
ERROR:  column a does not exist
postgres=# SELECT 1;
?column?
--
   1
(1 row)

postgres=# BEGIN;
WARNING:  there is already a transaction in progress
BEGIN
postgres=# ROLLBACK;
ROLLBACK


For the first statement in a transaction after the implicit BEGIN it does 
not work:


postgres=# ROLLBACK;
ROLLBACK
postgres=#
postgres=# SELECT a;
ERROR:  column a does not exist
postgres=# SELECT 1;
ERROR:  current transaction is aborted, commands ignored until end of 
transaction block



With the attaced patch it works correctly even for the first statement.

postgres=# \set AUTOCOMMIT off
postgres=# \set ON_ERROR_ROLLBACK interactive
postgres=# SELECT a;
ERROR:  column a does not exist
postgres=# SELECT 1;
?column?
--
   1
(1 row)

postgres=# BEGIN;
WARNING:  there is already a transaction in progress
BEGIN
postgres=# ABORT;
ROLLBACK


Please check the patch and apply to CVS tip.
I think it would be good to add regression tests for AUTOCOMMIT and 
ON_ERROR_ROLLBACK and possibly others. There are currently no regression 
tests specifically for psql features, but since the regression tests are 
executed via psql, there would be no problem in creating a set of such 
tests, right?. I could write some.


Best Regards,
Michael Paesold 


psql.patch
Description: Binary data

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [PATCHES] FAQ numbering fix

2005-09-16 Thread Bruce Momjian

Patch applied.  Thanks.

---


Michael Fuhr wrote:
 Two items the body of the FAQ are numbered 4.20 (the table of
 contents correctly has 4.20 and 4.21).  This patch fixes that.
 
 -- 
 Michael Fuhr

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 4: Have you searched our list archives?
 
http://archives.postgresql.org

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [PATCHES] Mistake of win32.mak in the Native mode of Windows

2005-09-16 Thread Bruce Momjian

Patch applied.  Thanks.

I also fixed the BCC build in the same way.

---


Hiroshi Saito wrote:
 Hi.
 
 This correction is required of nmake of Windows.
 Please check it. 
 
 Thanks.
 
 Regards,
 Hiroshi Saito

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster