Re: [PATCHES] [COMMITTERS] pgsql: Remove obsoleted README files.

2007-12-03 Thread Hannes Eder

Tom Lane wrote:

Removed Files:
-
pgsql/contrib/spi:
README.spi

(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/spi/README.spi)
  


Don't try to install a missing file ;) Install.pm needs an update, see 
attached .diff


Best,
-Hannes


Index: src/tools/msvc/Install.pm
===
--- src/tools/msvc/Install.pm	(revision 404)
+++ src/tools/msvc/Install.pm	(working copy)
@@ -339,7 +339,7 @@
 
 # Special case for contrib/spi
 $flist =
-README.spi autoinc.example insert_username.example moddatetime.example refint.example timetravel.example
+autoinc.example insert_username.example moddatetime.example refint.example timetravel.example
   if ($d eq 'spi');
 foreach my $f (split /\s+/,$flist)
 {

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

   http://archives.postgresql.org


Re: [PATCHES] parse_expr.c:typecast_expression:return immediate on NULL input

2007-11-23 Thread Hannes Eder
Tom Lane [EMAIL PROTECTED] writes:
 Hannes Eder [EMAIL PROTECTED] writes:
  in parse_expr.c:typecast_expression: return immediate on NULL
 input, i.e. do not lookup target type Oid as it is not required.
 
 I think the existing ordering is intentional, to detect and error
 out if the given typename is bogus.

Ups, yes, you are right. typecast_expression calls typenameTypeId and
this calls typenameType, which will ereport an error if the typename
cannot be found.

-Hannes


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


[PATCHES] parse_expr.c:typecast_expression:return immediate on NULL input

2007-11-23 Thread Hannes Eder
in parse_expr.c:typecast_expression: return immediate on NULL input, 
i.e. do not lookup target type Oid as it is not required.


-Hannes
Index: src/backend/parser/parse_expr.c
===
--- src/backend/parser/parse_expr.c (revision 377)
+++ src/backend/parser/parse_expr.c (working copy)
@@ -2226,11 +2226,11 @@
Oid targetType;
int32   targetTypmod;
 
-   targetType = typenameTypeId(pstate, typename, targetTypmod);
-
if (inputType == InvalidOid)
return expr;/* do nothing if NULL input */
 
+   targetType = typenameTypeId(pstate, typename, targetTypmod);
+
expr = coerce_to_target_type(pstate, expr, inputType,
 targetType, 
targetTypmod,
 
COERCION_EXPLICIT,

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


[PATCHES] minor compiler warning in libpg/fe-secure.c on win32 (msvc)

2007-10-02 Thread Hannes Eder

Hi,

while rebuilding the entire project I ran across following warning:

.\src\interfaces\libpq\fe-secure.c(593): warning C4101: 'fp' : 
unreferenced local variable


see attached diff for a fix.

-Hannes

*** ../pgsql-cvshead/src/interfaces/libpq/fe-secure.c	Tue Oct  2 11:43:05 2007
--- src/interfaces/libpq/fe-secure.c	Tue Oct  2 23:37:48 2007
***
*** 588,596 
  
  #ifndef WIN32
  	struct stat buf2;
  #endif
  	char		fnbuf[MAXPGPATH];
- 	FILE		*fp;
  	BIO			*bio;
  	PGconn		*conn = (PGconn *) SSL_get_app_data(ssl);
  	char		sebuf[256];
--- 588,596 
  
  #ifndef WIN32
  	struct stat buf2;
+ 	FILE		*fp;
  #endif
  	char		fnbuf[MAXPGPATH];
  	BIO			*bio;
  	PGconn		*conn = (PGconn *) SSL_get_app_data(ssl);
  	char		sebuf[256];

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

   http://archives.postgresql.org


[PATCHES] msvc = VC7 understands __FUNCTION__

2007-09-28 Thread Hannes Eder

Hi,

Starting from version VC7 msvc supports __FUNCTION__, so I think this 
could be enabled in pg_config.h.win32, see attached diff.


-Hannes




*** ../pgsql-cvshead/src/include/pg_config.h.win32	Mon Apr 16 20:39:19 2007
--- src/include/pg_config.h.win32	Fri Sep 28 22:32:50 2007
***
*** 4,12 
  /* This file is generated from MingW ./configure, and with the following
   * changes to be valid for Visual C++ (and compatible):
   *
!  * HAVE_CBRT, HAVE_FUNCNAME_FUNC, HAVE_FUNCNAME_FUNCTION, HAVE_GETOPT,
!  * HAVE_GETOPT_H, HAVE_GETOPT_LONG, HAVE_RINT, HAVE_STRINGS_H, 
!  * HAVE_STRTOLL, HAVE_STRTOULL, HAVE_STRUCT_OPTION, ENABLE_THREAD_SAFETY
   *
   */
  
--- 4,12 
  /* This file is generated from MingW ./configure, and with the following
   * changes to be valid for Visual C++ (and compatible):
   *
!  * HAVE_CBRT, HAVE_FUNCNAME_FUNC, HAVE_GETOPT, HAVE_GETOPT_H,
!  * HAVE_GETOPT_LONG, HAVE_RINT, HAVE_STRINGS_H, HAVE_STRTOLL,
!  * HAVE_STRTOULL, HAVE_STRUCT_OPTION, ENABLE_THREAD_SAFETY
   *
   */
  
***
*** 134,140 
  //#define HAVE_FUNCNAME__FUNC 1
  
  /* Define to 1 if your compiler understands __FUNCTION__. */
! #undef HAVE_FUNCNAME__FUNCTION
  
  /* Define to 1 if you have getaddrinfo(). */
  /* #undef HAVE_GETADDRINFO */
--- 134,140 
  //#define HAVE_FUNCNAME__FUNC 1
  
  /* Define to 1 if your compiler understands __FUNCTION__. */
! #define HAVE_FUNCNAME__FUNCTION 1
  
  /* Define to 1 if you have getaddrinfo(). */
  /* #undef HAVE_GETADDRINFO */

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


[PATCHES] minor compiler warning in backend/utils/adt/tsrank.c

2007-09-20 Thread Hannes Eder
while rebuilding postgres with msvc 2005 I noticed some minor compiler 
warnings:


.\src\backend\utils\adt\tsrank.c(24): warning C4305: 'initializing' : 
truncation from 'double' to 'float'
.\src\backend\utils\adt\tsrank.c(24): warning C4305: 'initializing' : 
truncation from 'double' to 'float'
.\src\backend\utils\adt\tsrank.c(24): warning C4305: 'initializing' : 
truncation from 'double' to 'float'
.\src\backend\utils\adt\tsrank.c(46): warning C4305: 'return' : 
truncation from 'double' to 'float4'
.\src\backend\utils\adt\tsrank.c(339): warning C4305: '=' : truncation 
from 'double' to 'float'


see attached diff

-Hannes

*** ../pgsql-cvshead/src/backend/utils/adt/tsrank.c Thu Sep 20 10:30:19 2007
--- src/backend/utils/adt/tsrank.c  Thu Sep 20 12:20:10 2007
***
*** 21,27 
  #include miscadmin.h
  
  
! static float weights[] = {0.1, 0.2, 0.4, 1.0};
  
  #define wpos(wep) ( w[ WEP_GETWEIGHT(wep) ] )
  
--- 21,27 
  #include miscadmin.h
  
  
! static float weights[] = {0.1f, 0.2f, 0.4f, 1.0f};
  
  #define wpos(wep) ( w[ WEP_GETWEIGHT(wep) ] )
  
***
*** 43,49 
  word_distance(int4 w)
  {
if (w  100)
!   return 1e-30;
  
return 1.0 / (1.005 + 0.05 * exp(((float4) w) / 1.5 - 2));
  }
--- 43,49 
  word_distance(int4 w)
  {
if (w  100)
!   return 1e-30f;
  
return 1.0 / (1.005 + 0.05 * exp(((float4) w) / 1.5 - 2));
  }
***
*** 336,342 
calc_rank_and(w, t, q) : calc_rank_or(w, t, q);
  
if (res  0)
!   res = 1e-20;
  
if ((method  RANK_NORM_LOGLENGTH)  t-size  0)
res /= log((double) (cnt_length(t) + 1)) / log(2.0);
--- 336,342 
calc_rank_and(w, t, q) : calc_rank_or(w, t, q);
  
if (res  0)
!   res = 1e-20f;
  
if ((method  RANK_NORM_LOGLENGTH)  t-size  0)
res /= log((double) (cnt_length(t) + 1)) / log(2.0);

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


Re: [PATCHES] [HACKERS] msvc, build and install with cygwin in the PATH

2007-06-06 Thread Hannes Eder

Magnus Hagander wrote:
Hannes Eder wrote:
 Is it worth doing this the Perl-way and using File::Find? If so, I 
can

 work an a patch for that.

 It's certainly cleaner that way, but I don't find it a major issue. 
But I'd

 rather see that fix than the other one.

Here we go. See attached patch. Your comments are welcome.

Hannes.

*** ..\pgsql-cvshead\src\tools\msvc\Install.pm  Mo Mai 14 16:36:10 2007
--- src\tools\msvc\Install.pm   Mi Jun  6 20:39:47 2007
***
*** 10,15 
--- 10,18 
  use Carp;
  use File::Basename;
  use File::Copy;
+ use File::Find;
+ use File::Glob;
+ use File::Spec;
  
  use Exporter;
  our (@ISA,@EXPORT_OK);
***
*** 99,104 
--- 102,142 
  print \n;
  }
  
+ sub FindFiles
+ {
+ my $spec = shift;
+ my $nonrecursive = shift;
+ my $pat = basename($spec);
+ my $dir = dirname($spec);
+ 
+ if ($dir eq '') { $dir = '.'; }
+ 
+ -d $dir || croak Could not list directory $dir: $!\n;
+ 
+ if ($nonrecursive)
+ {
+ return glob($spec);
+ }
+ 
+ # borrowed from File::DosGlob
+ # escape regex metachars but not glob chars
+ $pat =~ s:([].+^\-\${}[|]):\\$1:g;
+ # and convert DOS-style wildcards to regex
+ $pat =~ s/\*/.*/g;
+ $pat =~ s/\?/.?/g;
+ 
+ $pat = '^' . $pat . '\z';
+ 
+ my @res;
+ find(
+ {
+ wanted = sub { /$pat/s  push (@res, 
File::Spec-canonpath($File::Find::name)); }
+ },
+ $dir
+ );
+ return @res;
+ }
+ 
  sub CopySetOfFiles
  {
  my $what = shift;
***
*** 106,126 
  my $target = shift;
  my $silent = shift;
  my $norecurse = shift;
- my $D;
  
- my $subdirs = $norecurse?'':'/s';
  print Copying $what unless ($silent);
! open($D, dir /b $subdirs $spec |) || croak Could not list $spec\n;
! while ($D)
  {
- chomp;
  next if /regress/; # Skip temporary install in regression subdir
! my $tgt = $target . basename($_);
  print .;
! my $src = $norecurse?(dirname($spec) . '/' . $_):$_;
! copy($src, $tgt) || croak Could not copy $src: $!\n;
  }
! close($D);
  print \n;
  }
  
--- 144,161 
  my $target = shift;
  my $silent = shift;
  my $norecurse = shift;
  
  print Copying $what unless ($silent);
! 
! foreach (FindFiles($spec, $norecurse))
  {
  next if /regress/; # Skip temporary install in regression subdir
! my $src = $_;
! my $tgt = $target . basename($src);
  print .;
! copy($src, $tgt) || croak Could not copy $src to $tgt: $!\n;
  }
! 
  print \n;
  }
  
***
*** 371,395 
  {
  my $target = shift;
  my $nlspath = shift;
- my $D;
  
  print Installing NLS files...;
  EnsureDirectories($target, share/locale);
! open($D,dir /b /s nls.mk|) || croak Could not list nls.mk\n;
! while ($D)
  {
- chomp;
  s/nls.mk/po/;
  my $dir = $_;
  next unless ($dir =~ /([^\\]+)\\po$/);
  my $prgm = $1;
  $prgm = 'postgres' if ($prgm eq 'backend');
- my $E;
- open($E,dir /b $dir\\*.po|) || croak Could not list contents of 
$_\n;
  
! while ($E)
  {
- chomp;
  my $lang;
  next unless /^(.*)\.po/;
  $lang = $1;
--- 406,425 
  {
  my $target = shift;
  my $nlspath = shift;
  
  print Installing NLS files...;
  EnsureDirectories($target, share/locale);
! 
! foreach (FindFiles(nls.mk))
  {
  s/nls.mk/po/;
  my $dir = $_;
  next unless ($dir =~ /([^\\]+)\\po$/);
  my $prgm = $1;
  $prgm = 'postgres' if ($prgm eq 'backend');
  
! foreach (FindFiles($dir\\*.po, 1))
  {
  my $lang;
  next unless /^(.*)\.po/;
  $lang = $1;
***
*** 401,409 
 croak(Could not run msgfmt on $dir\\$_);
  print .;
  }
- close($E);
  }
! close($D);
  print \n;
  }
  
--- 431,438 
 croak(Could not run msgfmt on $dir\\$_);
  print .;
  }
  }
! 
  print \n;
  }
  

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


Re: [PATCHES] [HACKERS] msvc, build and install with cygwin in the PATH

2007-05-30 Thread Hannes Eder

Andrew Dunstan schrieb:

Hannes Eder wrote:
-open($D, dir /b $subdirs $spec |) || croak Could not list 
$spec\n;
+open($D, cmd /c dir /b $subdirs $spec |) || croak Could not 
list $spec\n;
 


What the heck are we doing here anyway? We should be doing this a la 
Perl - calling out to dir /b is surely not the best way to do this. 
If we need to recurse we should use File::Find.
I think since the code in src/tools/msvc is specific to MSVC and 
therefor, at least currently, specific to Windows. Calling out to dir 
/b /s or cmd /c dir /b /s works on WinNT and higher. On Win9x/ME 
command.com should be called instead of cmd.exe. In order to be more 
portable maybe we should use the environment variable COMSPEC, which 
should always point to an appropriate command processor.


Is it worth doing this the Perl-way and using File::Find? If so, I can 
work an a patch for that.


Hannes.


---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq


[PATCHES] msvc, build and install with cygwin in the PATH

2007-05-23 Thread Hannes Eder
With a small modification to src/tools/msvc/Install.pm (see attached 
patch) it's possible for me to build with msvc and install postgres on a 
Windows xp box and leave cygwin in the PATH. Since I use cygwin 
frequently it's usfull for me to have it in the PATH.


This might not work on Win9x platforms. But is that platform supported 
for development anyway?


Hannes.


Index: src/tools/msvc/Install.pm
===
--- src/tools/msvc/Install.pm   (revision 44)
+++ src/tools/msvc/Install.pm   (working copy)
@@ -110,7 +110,7 @@
 
 my $subdirs = $norecurse?'':'/s';
 print Copying $what unless ($silent);
-open($D, dir /b $subdirs $spec |) || croak Could not list $spec\n;
+open($D, cmd /c dir /b $subdirs $spec |) || croak Could not list 
$spec\n;
 while ($D)
 {
 chomp;
@@ -375,7 +375,7 @@
 
 print Installing NLS files...;
 EnsureDirectories($target, share/locale);
-open($D,dir /b /s nls.mk|) || croak Could not list nls.mk\n;
+open($D,cmd /c dir /b /s nls.mk|) || croak Could not list nls.mk\n;
 while ($D)
 {
 chomp;

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

   http://archives.postgresql.org