Re: [PATCHES] MinGW patch

2003-09-07 Thread Peter Eisentraut
Bruce Momjian writes:

In mbprint.c:

+ #ifndef PGSCRIPTS
+ #include settings.h
+ #endif

Why is this needed, considering that the rest of the code was not changed
to make use of any setting?  The print modules in psql should not make use
of psql-specific settings.  That's why there are extensive separate
structures to pass this information.

Also, I'm beginning to feel that there are too many places where the lack
of getpwuid() is being worked around.  That needs to be centralized.

Lastly, since there is not going to be a Windows port in 7.4, why was this
committed to the head branch?

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [PATCHES] MinGW patch

2003-09-07 Thread Bruce Momjian
Peter Eisentraut wrote:
 Bruce Momjian writes:
 
 In mbprint.c:
 
 + #ifndef PGSCRIPTS
 + #include settings.h
 + #endif
 
 Why is this needed, considering that the rest of the code was not changed
 to make use of any setting?  The print modules in psql should not make use
 of psql-specific settings.  That's why there are extensive separate
 structures to pass this information.

The problem is that mbvalidate() has this code:

if (GetVariableBool(pset.vars, WIN32_CONSOLE))
CharToOem(pwcs, pwcs);

That's why I needed the #ifdef so it only tests from psql.  This code
was just broken without that test, and because no one else has done
Win32 compiles since it was added, no one saw it.

 Also, I'm beginning to feel that there are too many places where the lack
 of getpwuid() is being worked around.  That needs to be centralized.

Yep.  Let me add that to my list for 7.5.

 Lastly, since there is not going to be a Windows port in 7.4, why was this
 committed to the head branch?

Yes, I knew someone would ask, and debated it myself.  Having these
patches in 7.4 allows us to have full-functional interfaces and client
binaries for MinGW.  This allows us to show progress on the Win32 port,
and for folks to start using MinGW in client applications.  Also, many
of these fixes will be needed for Cygwin and other Win32 platforms, so
it seemed best to fix them in head and just patch them back to the WIN32
branch.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (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] MinGW patch

2003-09-07 Thread Peter Eisentraut
Bruce Momjian writes:

 The problem is that mbvalidate() has this code:

 if (GetVariableBool(pset.vars, WIN32_CONSOLE))
 CharToOem(pwcs, pwcs);

 That's why I needed the #ifdef so it only tests from psql.  This code
 was just broken without that test, and because no one else has done
 Win32 compiles since it was added, no one saw it.

Interesting, considering that WIN32_CONSOLE isn't being set anywhere.

Anyway, that code needs to be removed/fixed, for the mentioned reasons.

-- 
Peter Eisentraut   [EMAIL PROTECTED]


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


Re: [PATCHES] MinGW patch

2003-09-07 Thread Bruce Momjian
Peter Eisentraut wrote:
 Bruce Momjian writes:
 
  As Tom mentioned, it doesn't find things like sys/socket.h, which we
  have added to src/include/port/win32/.  This was done to elimintate
  #ifdef of the include files that are Win32-specific.
 
 OK, then you can reference the top source directory as $srcdir in
 configure.

OK, new code is:

if test $PORTNAME = win32
then
CPPFLAGS=$CPPFLAGS -I$srcdir/src/include/port/win32
fi

Thanks.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (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


[PATCHES] MinGW patch

2003-09-06 Thread Bruce Momjian
I have applied the following patch to allow MinGW to again work on CVS.

THe patch makes the following changes:

o allow configure to see include/port/win32 include files
o add matching Win32 accept() prototype
o allow pg_id to compile with native Win32 API
o fix invalide mbvalidate() function calls (existing bug)
o allow /scripts to compile with native Win32 API
o add win32.c to Win32 compiles (already in *.mak files)

Other Win32 compile platforms were going to need some of these fixes
anyway.

These changes allow the first client-level compiles on Win32 using our
existing Makefile system (no *.mak), and not using Cygwin.  All
interfaces and client apps work except for pg_resetxlog (no fsync).

With these patches, psql works using CMD.EXE:

U:\psql -h 172.20.0.1 -U postgres test
Welcome to psql 7.4beta2, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help on internal slash commands
   \g or terminate with semicolon to execute query
   \q to quit

test=# select * from pg_language;
 lanname  | lanispl | lanpltrusted | lanplcallfoid | lanvalidator |lanacl


--+-+--+---+--+---
 internal | f   | f| 0 | 2246 |
 c| f   | f| 0 | 2247 |
 sql  | f   | t| 0 | 2248 | 
{=U/postgres}
(3 rows)

test=#

The backend still does not link.

The MinGW command console seems to have some problems with flushing
output to the screen (no prompt, no errors display), but the same binary
runs fine in CMD.EXE.  We can look at that later.

I will update the WIN32 branch to match current CVS so all the Win32
fixes will be in that branch.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073
Index: configure
===
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.292
diff -c -c -r1.292 configure
*** configure   1 Sep 2003 23:01:49 -   1.292
--- configure   7 Sep 2003 01:53:57 -
***
*** 2370,2375 
--- 2370,2381 
  { echo $as_me:$LINENO: using CFLAGS=$CFLAGS 5
  echo $as_me: using CFLAGS=$CFLAGS 6;}
  
+ # We already have this in Makefile.win32, but configure needs it too
+ if test $PORTNAME = win32
+ then
+   CPPFLAGS=$CPPFLAGS -Isrc/include/port/win32
+ fi
+ 
  # Check if the compiler still works with the template settings
  echo $as_me:$LINENO: checking whether the C compiler still works 5
  echo $ECHO_N checking whether the C compiler still works... $ECHO_C 6
***
*** 10810,10828 
  fi
  echo $as_me:$LINENO: checking types of arguments for accept() 5
  echo $ECHO_N checking types of arguments for accept()... $ECHO_C 6
!  if test ${ac_cv_func_accept_arg1+set} = set; then
echo $ECHO_N (cached) $ECHO_C 6
  else
!if test ${ac_cv_func_accept_arg2+set} = set; then
echo $ECHO_N (cached) $ECHO_C 6
  else
! if test ${ac_cv_func_accept_arg3+set} = set; then
echo $ECHO_N (cached) $ECHO_C 6
  else
!  for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
!  for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 
'void *'; do
!   for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 
'void'; do
!cat conftest.$ac_ext _ACEOF
  #line $LINENO configure
  #include confdefs.h
  #ifdef HAVE_SYS_TYPES_H
--- 10816,10838 
  fi
  echo $as_me:$LINENO: checking types of arguments for accept() 5
  echo $ECHO_N checking types of arguments for accept()... $ECHO_C 6
!  if test ${ac_cv_func_accept_return+set} = set; then
!   echo $ECHO_N (cached) $ECHO_C 6
! else
!if test ${ac_cv_func_accept_arg1+set} = set; then
echo $ECHO_N (cached) $ECHO_C 6
  else
! if test ${ac_cv_func_accept_arg2+set} = set; then
echo $ECHO_N (cached) $ECHO_C 6
  else
!  if test ${ac_cv_func_accept_arg3+set} = set; then
echo $ECHO_N (cached) $ECHO_C 6
  else
!   for ac_cv_func_accept_return in 'int' 'unsigned int PASCAL'; do
!   for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
!for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 
'void *'; do
! for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 
'void'; do
!  cat conftest.$ac_ext _ACEOF
  #line $LINENO configure
  #include confdefs.h
  #ifdef HAVE_SYS_TYPES_H
***
*** 10831,10837 
  #ifdef HAVE_SYS_SOCKET_H
  #include sys/socket.h
  #endif
!