[PATCHES] pg_restore -F bug

2005-04-29 Thread Neil Conway
This patch fixes a bug in the error message emitted by pg_restore on an 
incorrect -F argument: write_msg() expects its first parameter to be a 
module name, not the format string. Patch applied to HEAD. Is this 
worth backporting?

BTW, is there a reason that pg_restore seems to accept 'f', 't', or 'c' 
parameters to this argument, but the documentation only documents 't' 
and 'c'?

-Neil
Index: src/bin/pg_dump/pg_restore.c
===
RCS file: /var/lib/cvs/pgsql/src/bin/pg_dump/pg_restore.c,v
retrieving revision 1.69
diff -c -r1.69 pg_restore.c
*** src/bin/pg_dump/pg_restore.c	22 Feb 2005 04:39:38 -	1.69
--- src/bin/pg_dump/pg_restore.c	29 Apr 2005 06:46:34 -
***
*** 313,319 
  break;
  
  			default:
! write_msg(unrecognized archive format '%s'; please specify 't' or 'c'\n,
  		  opts-formatName);
  exit(1);
  		}
--- 313,319 
  break;
  
  			default:
! write_msg(NULL, unrecognized archive format '%s'; please specify 't' or 'c'\n,
  		  opts-formatName);
  exit(1);
  		}

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [PATCHES] [INTERFACES] bcc32 libpq compile problem

2005-04-29 Thread [EMAIL PROTECTED]
thanks a lot ... now i go to try ...

fabio
 Fabio Guidi wrote:
  the compiler build correctly the package without error message ?
  
  Bruce Momjian ha scritto:
 
  I downloaded the Borland compiler and am running build tests now.

 I finally got it working.  I had to make major changes to the build
 file.  The new attached bcc32.mak should build on your 8.0.X system, and
 this file will be in 8.0.3.

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




Navighi a 4 MEGA e i primi 3 mesi sono GRATIS. 
Scegli Libero Adsl Flat senza limiti su http://www.libero.it



---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])


Re: [PATCHES] [INTERFACES] bcc32 libpq compile problem

2005-04-29 Thread [EMAIL PROTECTED]
I try to use your make file, but i obtain an error at the end of build ...

this time the directory has created and several objs are present in it...

i attach the screenshot that appear...

thanks a lot again
fabio

 Fabio Guidi wrote:
  the compiler build correctly the package without error message ?
 
  Bruce Momjian ha scritto:
 
  I downloaded the Borland compiler and am running build tests now.
 
 I finally got it working.  I had to make major changes to the build
 file.  The new attached bcc32.mak should build on your 8.0.X system, and
 this file will be in 8.0.3.

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




Navighi a 4 MEGA e i primi 3 mesi sono GRATIS. 
Scegli Libero Adsl Flat senza limiti su http://www.libero.it
C:\postgresql_src\postgresql-8.0.2\src\interfaces\libpqmake -N -DCFG=Release /f
 bcc32.mak
MAKE Version 5.2  Copyright (c) 1987, 2000 Borland
Building the Win32 DLL and Static Library...

Configuration Release

copy pthread.h.win32 pthread.h
1 file(s) copied.
echo #define SYSCONFDIR   pg_config_paths.h
bcc32.exe -Ic:\Borland\Bcc55\include;..\..\include -n.\Release -WD -c
-DFRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP; -tWM   -a8 -X -w-us
e -w-par -w-pia -w-csu -w-aus -w-ccc -O -Oi -OS -DNDEBUG win32.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
win32.c:
bcc32.exe @MAKE0002.@@@
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
..\..\port\getaddrinfo.c:
Warning W8017 ..\..\include\port/win32.h 41: Redefinition of 'DLLIMPORT' is not
identical
Warning W8017 ..\..\include\port/win32.h 144: Redefinition of 'SIGUSR1' is not i
dentical
Warning W8017 ..\..\include\port/win32.h 145: Redefinition of 'SIGUSR2' is not i
dentical
bcc32.exe @MAKE0003.@@@
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
..\..\port\pgstrcasecmp.c:
Warning W8017 ..\..\include\port/win32.h 41: Redefinition of 'DLLIMPORT' is not
identical
Warning W8017 ..\..\include\port/win32.h 144: Redefinition of 'SIGUSR1' is not i
dentical
Warning W8017 ..\..\include\port/win32.h 145: Redefinition of 'SIGUSR2' is not i
dentical
bcc32.exe @MAKE0004.@@@
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
..\..\port\thread.c:
Warning W8017 ..\..\include\port/win32.h 41: Redefinition of 'DLLIMPORT' is not
identical
Warning W8017 ..\..\include\port/win32.h 144: Redefinition of 'SIGUSR1' is not i
dentical
Warning W8017 ..\..\include\port/win32.h 145: Redefinition of 'SIGUSR2' is not i
dentical
bcc32.exe @MAKE0005.@@@
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
..\..\port\inet_aton.c:
Warning W8017 ..\..\include\port/win32.h 41: Redefinition of 'DLLIMPORT' is not
identical
Warning W8017 ..\..\include\port/win32.h 144: Redefinition of 'SIGUSR1' is not i
dentical
Warning W8017 ..\..\include\port/win32.h 145: Redefinition of 'SIGUSR2' is not i
dentical
bcc32.exe @MAKE0006.@@@
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
..\..\port\crypt.c:
Warning W8017 ..\..\include\port/win32.h 41: Redefinition of 'DLLIMPORT' is not
identical
Warning W8017 ..\..\include\port/win32.h 144: Redefinition of 'SIGUSR1' is not i
dentical
Warning W8017 ..\..\include\port/win32.h 145: Redefinition of 'SIGUSR2' is not i
dentical
bcc32.exe @MAKE0007.@@@
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
..\..\port\noblock.c:
Warning W8017 ..\..\include\port/win32.h 41: Redefinition of 'DLLIMPORT' is not
identical
Warning W8017 ..\..\include\port/win32.h 144: Redefinition of 'SIGUSR1' is not i
dentical
Warning W8017 ..\..\include\port/win32.h 145: Redefinition of 'SIGUSR2' is not i
dentical
Warning W8075 ..\..\port\noblock.c 30: Suspicious pointer conversion in function
 pg_set_noblock
Warning W8075 ..\..\port\noblock.c 53: Suspicious pointer conversion in function
 pg_set_block
bcc32.exe @MAKE0008.@@@
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
..\..\backend\libpq\md5.c:
Warning W8017 ..\..\include\port/win32.h 41: Redefinition of 'DLLIMPORT' is not
identical
Warning W8017 ..\..\include\port/win32.h 144: Redefinition of 'SIGUSR1' is not i
dentical
Warning W8017 ..\..\include\port/win32.h 145: Redefinition of 'SIGUSR2' is not i
dentical
bcc32.exe @MAKE0009.@@@
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
..\..\backend\libpq\ip.c:
Warning W8017 ..\..\include\port/win32.h 41: Redefinition of 'DLLIMPORT' is not
identical
Warning W8017 ..\..\include\port/win32.h 144: Redefinition of 'SIGUSR1' is not i
dentical
Warning W8017 ..\..\include\port/win32.h 145: Redefinition of 'SIGUSR2' is not i
dentical
bcc32.exe -Ic:\Borland\Bcc55\include;..\..\include 

[PATCHES] format string cleanup

2005-04-29 Thread Neil Conway
GCC 4.0 includes a new warning option, -Wformat-literal, that emits a 
warning when a variable is used as a format string for printf() and 
similar functions (if the variable is derived from untrusted data, it 
could include unexpected formatting sequences). This emits too many 
warnings to be enabled by default, but it does flag a few dubious 
constructs in the Postgres tree. This patch fixes up the obvious stuff, 
when a function takes a format string and the caller passes a variable 
format string but no additional arguments.

Most of these are harmless (e.g. the ruleutils stuff), but there is at 
least one actual bug here. If you create a trigger named %sfoo, 
pg_dump will read unitialized memory and likely not dump the trigger 
correctly:

= create trigger %sxyz_trig before insert on xyz for each row execute 
procedure xyz();

yields the following pg_dump output:
CREATE TRIGGER %sxyz_trigxyz_trig
BEFORE INSERT ON xyz
FOR EACH ROW
EXECUTE PROCEDURE xyz();
Barring any objections, I'll apply this to HEAD and backport it to 
stable branches back to 7.2 tomorrow.

-Neil
Index: src/backend/utils/adt/ruleutils.c
===
RCS file: /var/lib/cvs/pgsql/src/backend/utils/adt/ruleutils.c,v
retrieving revision 1.193
diff -c -r1.193 ruleutils.c
*** src/backend/utils/adt/ruleutils.c	14 Apr 2005 20:03:26 -	1.193
--- src/backend/utils/adt/ruleutils.c	29 Apr 2005 07:36:32 -
***
*** 733,739 
  		AttrNumber	attnum = idxrec-indkey.values[keyno];
  
  		if (!colno)
! 			appendStringInfo(buf, sep);
  		sep = , ;
  
  		if (attnum != 0)
--- 733,739 
  		AttrNumber	attnum = idxrec-indkey.values[keyno];
  
  		if (!colno)
! 			appendStringInfoString(buf, sep);
  		sep = , ;
  
  		if (attnum != 0)
***
*** 1885,1891 
  			Oid			sortcoltype;
  			TypeCacheEntry *typentry;
  
! 			appendStringInfo(buf, sep);
  			sortexpr = get_rule_sortgroupclause(srt, query-targetList,
  force_colno, context);
  			sortcoltype = exprType(sortexpr);
--- 1885,1891 
  			Oid			sortcoltype;
  			TypeCacheEntry *typentry;
  
! 			appendStringInfoString(buf, sep);
  			sortexpr = get_rule_sortgroupclause(srt, query-targetList,
  force_colno, context);
  			sortcoltype = exprType(sortexpr);
***
*** 1954,1960 
  			{
  SortClause *srt = (SortClause *) lfirst(l);
  
! appendStringInfo(buf, sep);
  get_rule_sortgroupclause(srt, query-targetList,
  		 false, context);
  sep = , ;
--- 1954,1960 
  			{
  SortClause *srt = (SortClause *) lfirst(l);
  
! appendStringInfoString(buf, sep);
  get_rule_sortgroupclause(srt, query-targetList,
  		 false, context);
  sep = , ;
***
*** 1976,1982 
  		if (tle-resjunk)
  			continue;			/* ignore junk entries */
  
! 		appendStringInfo(buf, sep);
  		sep = , ;
  		colno++;
  
--- 1976,1982 
  		if (tle-resjunk)
  			continue;			/* ignore junk entries */
  
! 		appendStringInfoString(buf, sep);
  		sep = , ;
  		colno++;
  
***
*** 2040,2046 
  		{
  			GroupClause *grp = (GroupClause *) lfirst(l);
  
! 			appendStringInfo(buf, sep);
  			get_rule_sortgroupclause(grp, query-targetList,
  	 false, context);
  			sep = , ;
--- 2040,2046 
  		{
  			GroupClause *grp = (GroupClause *) lfirst(l);
  
! 			appendStringInfoString(buf, sep);
  			get_rule_sortgroupclause(grp, query-targetList,
  	 false, context);
  			sep = , ;
***
*** 2229,2235 
  		if (tle-resjunk)
  			continue;			/* ignore junk entries */
  
! 		appendStringInfo(buf, sep);
  		sep = , ;
  
  		/*
--- 2229,2235 
  		if (tle-resjunk)
  			continue;			/* ignore junk entries */
  
! 		appendStringInfoString(buf, sep);
  		sep = , ;
  
  		/*
***
*** 2301,2307 
  		if (tle-resjunk)
  			continue;			/* ignore junk entries */
  
! 		appendStringInfo(buf, sep);
  		sep = , ;
  
  		/*
--- 2301,2307 
  		if (tle-resjunk)
  			continue;			/* ignore junk entries */
  
! 		appendStringInfoString(buf, sep);
  		sep = , ;
  
  		/*
***
*** 3268,3274 
  	if (tupdesc == NULL ||
  		!tupdesc-attrs[i]-attisdropped)
  	{
! 		appendStringInfo(buf, sep);
  		get_rule_expr(e, context, true);
  		sep = , ;
  	}
--- 3268,3274 
  	if (tupdesc == NULL ||
  		!tupdesc-attrs[i]-attisdropped)
  	{
! 		appendStringInfoString(buf, sep);
  		get_rule_expr(e, context, true);
  		sep = , ;
  	}
***
*** 3280,3286 
  	{
  		if (!tupdesc-attrs[i]-attisdropped)
  		{
! 			appendStringInfo(buf, sep);
  			appendStringInfo(buf, NULL);
  			sep = , ;
  		}
--- 3280,3286 
  	{
  		if (!tupdesc-attrs[i]-attisdropped)
  		{
! 			appendStringInfoString(buf, sep);
  			appendStringInfo(buf, NULL);
  			sep = , ;
  		}
***
*** 3415,3421 

Re: [PATCHES] [INTERFACES] bcc32 libpq compile problem

2005-04-29 Thread [EMAIL PROTECTED]
There where an extra character in the .mak file, and then i try to rebuild and 
now i obtain these errors ...

at the and a file called blibpq.lib was built but it don't seem valid.



 Fabio Guidi wrote:
  the compiler build correctly the package without error message ?
 
  Bruce Momjian ha scritto:
 
  I downloaded the Borland compiler and am running build tests now.

 I finally got it working.  I had to make major changes to the build
 file.  The new attached bcc32.mak should build on your 8.0.X system, and
 this file will be in 8.0.3.
 
 --
   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
 




Navighi a 4 MEGA e i primi 3 mesi sono GRATIS. 
Scegli Libero Adsl Flat senza limiti su http://www.libero.it
bcc32.exe -Ic:\Borland\Bcc55\include;..\..\include -n.\Release -WD -c
-DFRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP; -tWM   -a8 -X -w-us
e -w-par -w-pia -w-csu -w-aus -w-ccc -O -Oi -OS -DNDEBUG pthread-win32.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
pthread-win32.c:
tlib.exe .\Release\blibpq.lib @MAKE0001.@@@
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation
+-.\Release\win32.obj 
+-.\Release\getaddrinfo.obj 
+-.\Release\pgstrcasecmp.obj 
+-.\Release\thread.obj 
+-.\Release\inet_aton.obj 
+-.\Release\crypt.obj 
+-.\Release\noblock.obj 
+-.\Release\md5.obj 
+-.\Release\ip.obj 
+-.\Release\fe-auth.obj 
+-.\Release\fe-protocol2.obj 
+-.\Release\fe-protocol3.obj 
+-.\Release\fe-connect.obj 
+-.\Release\fe-exec.obj 
+-.\Release\fe-lobj.obj 
+-.\Release\fe-misc.obj 
+-.\Release\fe-print.obj 
+-.\Release\fe-secure.obj 
+-.\Release\pqexpbuffer.obj 
+-.\Release\pqsignal.obj 
+-.\Release\wchar.obj 
+-.\Release\encnames.obj 
+-.\Release\pthread-win32.obj 
+-
Warning: 'win32' not found in library
Warning: 'getaddrinfo' not found in library
Warning: 'pgstrcasecmp' not found in library
Warning: 'thread' not found in library
Warning: 'inet_aton' not found in library
Warning: 'crypt' not found in library
Warning: 'noblock' not found in library
Warning: 'md5' not found in library
Warning: 'ip' not found in library
Warning: 'fe-auth' not found in library
Warning: 'fe-protocol2' not found in library
Warning: 'fe-protocol3' not found in library
Warning: 'fe-connect' not found in library
Warning: 'fe-exec' not found in library
Warning: 'fe-lobj' not found in library
Warning: 'fe-misc' not found in library
Warning: public '_pqFlush' in module 'fe-misc' clashes with prior module 
'fe-exec'
Warning: 'fe-print' not found in library
Warning: 'fe-secure' not found in library
Warning: 'pqexpbuffer' not found in library
Warning: 'pqsignal' not found in library
Warning: 'wchar' not found in library
Warning: 'encnames' not found in library
Warning: 'pthread-win32' not found in library
Warning: '' not found in library
Warning: '.OBJ' file not found
bcc32.exe -Ic:\Borland\Bcc55\include;..\..\include -n.\Release -WD -c
-DFRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP; -tWM   -a8 -X -w-us
e -w-par -w-pia -w-csu -w-aus -w-ccc -O -Oi -OS -DNDEBUG libpqdll.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
libpqdll.c:
brcc32.exe -l 0x409 -ic:\Borland\Bcc55\include -fo.\Release\libpq.res
libpq.rc
Borland Resource Compiler  Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation.  All rights reserved.
ilink32.exe @MAKE.@@@
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
implib -w .\Release\blibpqdll.lib blibpqdll.def .\Release\blibpq.dll


Borland Implib Version 3.0.22 Copyright (c) 1991, 2000 Inprise Corporation
Name: 'blibpqdll' Ext: '.dll' Base: 0x
Name: 'BLIBPQ' Ext: '.dll' Base: 0x
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])


Re: [PATCHES] [INTERFACES] bcc32 libpq compile problem

2005-04-29 Thread [EMAIL PROTECTED]
All OK with libpq, what can i do to work under windows with ecpg ?

Thanks a lot

Fabio

 Fabio Guidi wrote:
  the compiler build correctly the package without error message ?
 
  Bruce Momjian ha scritto:
 
  I downloaded the Borland compiler and am running build tests now.

 I finally got it working.  I had to make major changes to the build
 file.  The new attached bcc32.mak should build on your 8.0.X system, and
 this file will be in 8.0.3.

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




Navighi a 4 MEGA e i primi 3 mesi sono GRATIS. 
Scegli Libero Adsl Flat senza limiti su http://www.libero.it



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


Re: [PATCHES] pg_restore -F bug

2005-04-29 Thread Bruce Momjian
Neil Conway wrote:
 This patch fixes a bug in the error message emitted by pg_restore on an 
 incorrect -F argument: write_msg() expects its first parameter to be a 
 module name, not the format string. Patch applied to HEAD. Is this 
 worth backporting?
 
 BTW, is there a reason that pg_restore seems to accept 'f', 't', or 'c' 
 parameters to this argument, but the documentation only documents 't' 
 and 'c'?

I didn't think pg_restore could use a text file, and I think it emits an
error if you try.  Maybe they accept the flag so they can throw a
meaningful error later.

-- 
  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 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [PATCHES] [INTERFACES] bcc32 libpq compile problem

2005-04-29 Thread Bruce Momjian
[EMAIL PROTECTED] wrote:
 There where an extra character in the .mak file, and then i try to rebuild 
 and now i obtain these errors ...
 
 at the and a file called blibpq.lib was built but it don't seem valid.
 

Here is a fix I forgot to send you that will allow libpq to compile. 
This patch will be in 8.0.X too.

-- 
  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
Index: src/interfaces/libpq/pthread-win32.c
===
RCS file: /cvsroot/pgsql/src/interfaces/libpq/pthread-win32.c,v
retrieving revision 1.4
diff -c -c -r1.4 pthread-win32.c
*** src/interfaces/libpq/pthread-win32.c1 Jan 2005 20:44:31 -   
1.4
--- src/interfaces/libpq/pthread-win32.c29 Apr 2005 13:40:34 -
***
*** 12,18 
  
  
  #include windows.h
! #include pthread.h
  
  HANDLE
  pthread_self()
--- 12,18 
  
  
  #include windows.h
! #include pthread.h
  
  HANDLE
  pthread_self()

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [PATCHES] [INTERFACES] bcc32 libpq compile problem

2005-04-29 Thread Bruce Momjian
[EMAIL PROTECTED] wrote:
 All OK with libpq, what can i do to work under windows with ecpg ?

Uh, we don't have any ecpg makefiles for MSC or BCC.  I am afraid you
will have to take the psql or libpq bcc32.mak and try to hack it around
to work, but it isn't going to be simple.

-- 
  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: Have you searched our list archives?

   http://archives.postgresql.org


Re: [PATCHES] pg_restore -F bug

2005-04-29 Thread Tom Lane
Neil Conway [EMAIL PROTECTED] writes:
 This patch fixes a bug in the error message emitted by pg_restore on an 
 incorrect -F argument: write_msg() expects its first parameter to be a 
 module name, not the format string. Patch applied to HEAD. Is this 
 worth backporting?

Certainly --- particularly if the error makes it dump core, as seems
likely (haven't tried it).

 BTW, is there a reason that pg_restore seems to accept 'f', 't', or 'c' 
 parameters to this argument, but the documentation only documents 't' 
 and 'c'?

I think the 'f' option is only intended for debugging purposes ...
Philip would know ...

regards, tom lane

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