Re: [PATCHES] [pgsql-hackers-win32] Repleacement for src/port/snprintf.c

2005-02-22 Thread Kurt Roeckx
On Mon, Feb 21, 2005 at 10:53:08PM -0500, Bruce Momjian wrote:
 
 Applied.

The configure test is a little broken.  It needs to quote the
$'s.

I've rewritten the test a little.


Kurt

Index: config/c-library.m4
===
RCS file: /projects/cvsroot/pgsql/config/c-library.m4,v
retrieving revision 1.30
diff -u -r1.30 c-library.m4
--- config/c-library.m4 22 Feb 2005 03:55:50 -  1.30
+++ config/c-library.m4 22 Feb 2005 18:53:23 -
@@ -279,19 +279,17 @@
 [AC_MSG_CHECKING([printf supports argument control])
 AC_CACHE_VAL(pgac_cv_printf_arg_control,
 [AC_TRY_RUN([#include stdio.h
+#include string.h
 
-int does_printf_have_arg_control()
+int main()
 {
   char buf[100];
 
   /* can it swap arguments? */
-  snprintf(buf, 100, %2$d|%1$d, 3, 4);
-  if (strcmp(buf, 4|3) != 0)
-return 0;
-  return 1;
-}
-main() {
-  exit(! does_printf_have_arg_control());
+  snprintf(buf, 100, %2\$d %1\$d, 3, 4);
+  if (strcmp(buf, 4 3) != 0)
+return 1;
+  return 0;
 }],
 [pgac_cv_printf_arg_control=yes],
 [pgac_cv_printf_arg_control=no],

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [PATCHES] Fix memcmp() with different sizes.

2004-02-03 Thread Kurt Roeckx
On Mon, Feb 02, 2004 at 09:27:46PM -0500, Tom Lane wrote:
 Kurt Roeckx [EMAIL PROTECTED] writes:
  -   if (memcmp(re_array[i].cre_pat, text_re, text_re_len) == 0 
  +   if (VARSIZE(re_array[i].cre_pat) == text_re_len 
  +   memcmp(re_array[i].cre_pat, text_re, text_re_len) == 0 
 
 This is not actually broken.  The first four bytes of what memcmp is
 comparing are the length, and so it'll fall out immediately anyway if
 the lengths differ.

That assumes the memcmp starts from the first char and not from
the last.  If it starts from the last you have undefined
behaviour.


Kurt


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


[PATCHES] Fix memcmp() with different sizes.

2004-02-02 Thread Kurt Roeckx
Not everything in the re_array is the same size.  This patch
first checks that they actually are the same size in the first
place.


Kurt

Index: src/backend/utils/adt/regexp.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/adt/regexp.c,v
retrieving revision 1.51
diff -u -r1.51 regexp.c
--- src/backend/utils/adt/regexp.c  19 Jan 2004 19:04:40 -  1.51
+++ src/backend/utils/adt/regexp.c  2 Feb 2004 22:20:18 -
@@ -119,7 +119,8 @@
 */
for (i = 0; i  num_res; i++)
{
-   if (memcmp(re_array[i].cre_pat, text_re, text_re_len) == 0 
+   if (VARSIZE(re_array[i].cre_pat) == text_re_len 
+   memcmp(re_array[i].cre_pat, text_re, text_re_len) == 0 
re_array[i].cre_flags == cflags)
{
/*

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [PATCHES] remove obsolete NULL casts

2004-01-05 Thread Kurt Roeckx
On Mon, Jan 05, 2004 at 04:31:40PM -0500, Neil Conway wrote:
 In any modern dialect of C, casting the NULL pointer literal to a
 specific pointer type is unnecessary. For example:
 
 char *foo;
 foo = malloc(...);
 if (foo == (char *) NULL) {...}


In src/backend/port/darwin/system.c you replaced:

execl(_PATH_BSHELL, sh, -c, command, (char *) NULL);

By:
execl(_PATH_BSHELL, sh, -c, command, NULL);

I think that is one of the exceptions where you do have to cast
it, because the type is unknown.  You can only remove the cast
when you actually know what pointer type it is.


Kurt


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


Re: [PATCHES] ISO year.

2003-12-19 Thread Kurt Roeckx
On Fri, Dec 19, 2003 at 07:14:53PM -0500, Bruce Momjian wrote:
 
 Which patch is OK?  The one attached?  You looked like you were making
 changes to this patch in your later emails.

That is the changed/good patch.


Kurt


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


[PATCHES] ISO year.

2003-12-18 Thread Kurt Roeckx
This patch allows you to use I as format specifier to get the
ISO year, the year correspondeing to the ISO week number (IW).


Kurt

Index: doc/src/sgml/func.sgml
===
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/func.sgml,v
retrieving revision 1.182
diff -u -r1.182 func.sgml
--- doc/src/sgml/func.sgml  16 Dec 2003 15:27:58 -  1.182
+++ doc/src/sgml/func.sgml  18 Dec 2003 15:29:28 -
@@ -3981,6 +3981,10 @@
entrylast digit of year/entry
/row
row
+   entryliteralI/literal/entry
+   entryISO year (The first Thursday of the new year is in week 1.)/entry
+   /row
+   row
entryliteralBC/literal or literalB.C./literal or
literalAD/literal or literalA.D./literal/entry
entryera indicator (upper case)/entry
Index: src/include/utils/timestamp.h
===
RCS file: /projects/cvsroot/pgsql-server/src/include/utils/timestamp.h,v
retrieving revision 1.32
diff -u -r1.32 timestamp.h
--- src/include/utils/timestamp.h   29 Nov 2003 22:41:16 -  1.32
+++ src/include/utils/timestamp.h   18 Dec 2003 15:29:28 -
@@ -248,5 +248,6 @@
 
 extern void isoweek2date(int woy, int *year, int *mon, int *mday);
 extern int date2isoweek(int year, int mon, int mday);
+extern int date2isoyear(int year, int mon, int mday);
 
 #endif   /* TIMESTAMP_H */
Index: src/backend/utils/adt/formatting.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/adt/formatting.c,v
retrieving revision 1.70
diff -u -r1.70 formatting.c
--- src/backend/utils/adt/formatting.c  29 Nov 2003 19:51:58 -  1.70
+++ src/backend/utils/adt/formatting.c  18 Dec 2003 15:29:30 -
@@ -544,6 +544,7 @@
DCH_WW,
DCH_W,
DCH_Y_YYY,
+   DCH_I,
DCH_,
DCH_YYY,
DCH_YY,
@@ -582,6 +583,7 @@
DCH_ww,
DCH_w,
DCH_y_yyy,
+   DCH_i,
DCH_,
DCH_yyy,
DCH_yy,
@@ -659,6 +661,7 @@
{HH12, 4, dch_time, DCH_HH12, TRUE},
{HH, 2, dch_time, DCH_HH, TRUE},
{IW, 2, dch_date, DCH_IW, TRUE},  /* I */
+   {I, 5, dch_date, DCH_I, TRUE},
{J, 1, dch_date, DCH_J, TRUE},/* J */
{MI, 2, dch_time, DCH_MI, TRUE},
{MM, 2, dch_date, DCH_MM, TRUE},
@@ -699,6 +702,7 @@
{hh12, 4, dch_time, DCH_HH12, TRUE},
{hh, 2, dch_time, DCH_HH, TRUE},
{iw, 2, dch_date, DCH_IW, TRUE},  /* i */
+   {i, 5, dch_date, DCH_I, TRUE},
{j, 1, dch_time, DCH_J, TRUE},/* j */
{mi, 2, dch_time, DCH_MI, TRUE},  /* m */
{mm, 2, dch_date, DCH_MM, TRUE},
@@ -2444,6 +2448,41 @@
tmfc-year += (cc * 1000);
 
return strdigits_len(inout) + 3 + SKIP_THth(suf);
+   }
+   break;
+   case DCH_I:
+   if (flag == TO_CHAR)
+   {
+   if (tm-tm_year =   tm-tm_year = -9998)
+   sprintf(inout, %0*d,
+   S_FM(suf) ? 0 : 4, 
+   YEAR_ABS(date2isoyear(
+   tm-tm_year,
+   tm-tm_mon,
+   tm-tm_mday)));
+   else
+   sprintf(inout, %d,
+   YEAR_ABS(date2isoyear(
+   tm-tm_year,
+   tm-tm_mon,
+   tm-tm_mday)));
+
+   if (S_THth(suf))
+   str_numth(p_inout, inout, S_TH_TYPE(suf));
+   return strlen(p_inout) - 1;
+   }
+   else if (flag == FROM_CHAR)
+   {
+   if (S_FM(suf) || is_next_separator(node))
+   {
+   sscanf(inout, %d, tmfc-year);
+   return strdigits_len(inout) - 1 + 
SKIP_THth(suf);
+   }
+   else
+   {
+   sscanf(inout, %04d, tmfc-year);
+   return 3 + SKIP_THth(suf);
+   }
}
break;
case DCH_:
Index: src/backend/utils/adt/timestamp.c

Re: [PATCHES] ISO year.

2003-12-18 Thread Kurt Roeckx
On Thu, Dec 18, 2003 at 11:41:18AM -0500, Tom Lane wrote:
 Kurt Roeckx [EMAIL PROTECTED] writes:
  This patch allows you to use I as format specifier to get the
  ISO year, the year correspondeing to the ISO week number (IW).
 
 The purpose of to_char() as I understand it is to be 100% Oracle
 compatible, not to invent new features at random.  Is this duplicating
 some Oracle functionality that was left out?

I have no idea if this in Oracle or not.  But it's something I
needed, and other people in the past asked about it too.

You could use the normal year instead of the iso year, but around
newyear this always gives problems.


Kurt


---(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] ISO year.

2003-12-18 Thread Kurt Roeckx
On Thu, Dec 18, 2003 at 06:47:41PM +0100, Peter Eisentraut wrote:
 Kurt Roeckx wrote:
  I have no idea if this in Oracle or not.  But it's something I
  needed, and other people in the past asked about it too.
 
 It is in Oracle, but you aren't exactly on the spot.  It should be
 
 IYYY - 4 digits  ('2003')
 IYY  - 3 digits  ('003')
 IY   - 2 digits  ('03')
 I- 1 digit   ('3')

I'll update the patch to support all of them.


Kurt


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


Re: [PATCHES] ISO year.

2003-12-18 Thread Kurt Roeckx
On Thu, Dec 18, 2003 at 06:47:41PM +0100, Peter Eisentraut wrote:
 Kurt Roeckx wrote:
  I have no idea if this in Oracle or not.  But it's something I
  needed, and other people in the past asked about it too.
 
 It is in Oracle, but you aren't exactly on the spot.  It should be
 
 IYYY - 4 digits  ('2003')
 IYY  - 3 digits  ('003')
 IY   - 2 digits  ('03')
 I- 1 digit   ('3')

Here is an updated patch that does that.


Kurt

Index: doc/src/sgml/func.sgml
===
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/func.sgml,v
retrieving revision 1.182
diff -u -r1.182 func.sgml
--- doc/src/sgml/func.sgml  16 Dec 2003 15:27:58 -  1.182
+++ doc/src/sgml/func.sgml  18 Dec 2003 18:57:56 -
@@ -3981,6 +3981,22 @@
entrylast digit of year/entry
/row
row
+   entryliteralIYYY/literal/entry
+   entryISO year (4 and more digits)/entry
+   /row
+   row
+   entryliteralIYY/literal/entry
+   entrylast 3 digits of ISO year/entry
+   /row
+   row
+   entryliteralIY/literal/entry
+   entrylast 2 digits of ISO year/entry
+   /row
+   row
+   entryliteralI/literal/entry
+   entrylast digits of ISO year/entry
+   /row
+   row
entryliteralBC/literal or literalB.C./literal or
literalAD/literal or literalA.D./literal/entry
entryera indicator (upper case)/entry
Index: src/include/utils/timestamp.h
===
RCS file: /projects/cvsroot/pgsql-server/src/include/utils/timestamp.h,v
retrieving revision 1.32
diff -u -r1.32 timestamp.h
--- src/include/utils/timestamp.h   29 Nov 2003 22:41:16 -  1.32
+++ src/include/utils/timestamp.h   18 Dec 2003 18:57:57 -
@@ -248,5 +248,6 @@
 
 extern void isoweek2date(int woy, int *year, int *mon, int *mday);
 extern int date2isoweek(int year, int mon, int mday);
+extern int date2isoyear(int year, int mon, int mday);
 
 #endif   /* TIMESTAMP_H */
Index: src/backend/utils/adt/formatting.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/adt/formatting.c,v
retrieving revision 1.70
diff -u -r1.70 formatting.c
--- src/backend/utils/adt/formatting.c  29 Nov 2003 19:51:58 -  1.70
+++ src/backend/utils/adt/formatting.c  18 Dec 2003 18:57:58 -
@@ -525,6 +525,10 @@
DCH_HH12,
DCH_HH,
DCH_IW,
+   DCH_IYYY,
+   DCH_IYY,
+   DCH_IY,
+   DCH_I,
DCH_J,
DCH_MI,
DCH_MM,
@@ -565,6 +569,10 @@
DCH_hh12,
DCH_hh,
DCH_iw,
+   DCH_iyyy,
+   DCH_iyy,
+   DCH_iy,
+   DCH_i,
DCH_j,
DCH_mi,
DCH_mm,
@@ -659,6 +667,10 @@
{HH12, 4, dch_time, DCH_HH12, TRUE},
{HH, 2, dch_time, DCH_HH, TRUE},
{IW, 2, dch_date, DCH_IW, TRUE},  /* I */
+   {IYYY, 4, dch_date, DCH_IYYY, TRUE},
+   {IYY, 3, dch_date, DCH_IYY, TRUE},
+   {IY, 2, dch_date, DCH_IY, TRUE},
+   {I, 1, dch_date, DCH_I, TRUE},
{J, 1, dch_date, DCH_J, TRUE},/* J */
{MI, 2, dch_time, DCH_MI, TRUE},
{MM, 2, dch_date, DCH_MM, TRUE},
@@ -699,6 +711,10 @@
{hh12, 4, dch_time, DCH_HH12, TRUE},
{hh, 2, dch_time, DCH_HH, TRUE},
{iw, 2, dch_date, DCH_IW, TRUE},  /* i */
+   {iyyy, 4, dch_date, DCH_IYYY, TRUE},
+   {iyy, 3, dch_date, DCH_IYY, TRUE},
+   {iy, 2, dch_date, DCH_IY, TRUE},
+   {i, 1, dch_date, DCH_I, TRUE},
{j, 1, dch_time, DCH_J, TRUE},/* j */
{mi, 2, dch_time, DCH_MI, TRUE},  /* m */
{mm, 2, dch_date, DCH_MM, TRUE},
@@ -2447,12 +2463,26 @@
}
break;
case DCH_:
+   case DCH_IYYY:
if (flag == TO_CHAR)
{
if (tm-tm_year =   tm-tm_year = -9998)
-   sprintf(inout, %0*d, S_FM(suf) ? 0 : 4, 
YEAR_ABS(tm-tm_year));
-   else
-   sprintf(inout, %d, YEAR_ABS(tm-tm_year));
+   sprintf(inout, %0*d,
+   S_FM(suf) ? 0 : 4,
+   arg == DCH_ ?
+   YEAR_ABS(tm-tm_year) :
+   YEAR_ABS(date2isoyear(
+   tm-tm_year,
+   tm-tm_mon,
+   tm-tm_mday)));
+   else
+   sprintf(inout, %d,
+   arg == DCH_

[PATCHES] Walker/mutator prototype.

2003-12-14 Thread Kurt Roeckx
This patch adds proper prototypes to the walkers and mutators.

I changed the patch as Greg Stark suggested.



Kurt

Index: src/backend/catalog/dependency.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/catalog/dependency.c,v
retrieving revision 1.34
diff -u -b -r1.34 dependency.c
--- src/backend/catalog/dependency.c29 Nov 2003 19:51:42 -  1.34
+++ src/backend/catalog/dependency.c14 Dec 2003 15:56:35 -
@@ -108,8 +108,7 @@
   ObjectAddresses *oktodelete,
   Relation depRel);
 static void doDeletion(const ObjectAddress *object);
-static bool find_expr_references_walker(Node *node,
-   find_expr_references_context 
*context);
+static bool find_expr_references_walker(Node *node, void *context);
 static void eliminate_duplicate_dependencies(ObjectAddresses *addrs);
 static int object_address_comparator(const void *a, const void *b);
 static void init_object_addresses(ObjectAddresses *addrs);
@@ -973,9 +972,10 @@
  * of the alias list when we find a reference to it.
  */
 static bool
-find_expr_references_walker(Node *node,
-   find_expr_references_context 
*context)
+find_expr_references_walker(Node *node, void *vcontext)
 {
+   find_expr_references_context *context = vcontext;
+
if (node == NULL)
return false;
if (IsA(node, Var))
Index: src/backend/commands/tablecmds.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/tablecmds.c,v
retrieving revision 1.94
diff -u -b -r1.94 tablecmds.c
--- src/backend/commands/tablecmds.c29 Nov 2003 19:51:47 -  1.94
+++ src/backend/commands/tablecmds.c14 Dec 2003 15:56:37 -
@@ -77,7 +77,7 @@
 
 static List *MergeAttributes(List *schema, List *supers, bool istemp,
List **supOids, List **supconstr, bool *supHasOids);
-static bool change_varattnos_of_a_node(Node *node, const AttrNumber *newattno);
+static bool change_varattnos_of_a_node(Node *node, AttrNumber *newattno);
 static void StoreCatalogInheritance(Oid relationId, List *supers);
 static int findAttrByName(const char *attributeName, List *schema);
 static void setRelhassubclassInRelation(Oid relationId, bool relhassubclass);
@@ -833,8 +833,10 @@
  * Note that the passed node tree is modified in place!
  */
 static bool
-change_varattnos_walker(Node *node, const AttrNumber *newattno)
+change_varattnos_walker(Node *node, void *context)
 {
+   const AttrNumber *newattno = context;
+
if (node == NULL)
return false;
if (IsA(node, Var))
@@ -855,11 +857,11 @@
return false;
}
return expression_tree_walker(node, change_varattnos_walker,
- (void *) newattno);
+   context);
 }
 
 static bool
-change_varattnos_of_a_node(Node *node, const AttrNumber *newattno)
+change_varattnos_of_a_node(Node *node, AttrNumber *newattno)
 {
return change_varattnos_walker(node, newattno);
 }
Index: src/backend/optimizer/path/costsize.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/optimizer/path/costsize.c,v
retrieving revision 1.117
diff -u -b -r1.117 costsize.c
--- src/backend/optimizer/path/costsize.c   3 Dec 2003 17:45:07 -   1.117
+++ src/backend/optimizer/path/costsize.c   14 Dec 2003 15:56:38 -
@@ -104,7 +104,7 @@
 
 static Selectivity estimate_hash_bucketsize(Query *root, Var *var,
 int nbuckets);
-static bool cost_qual_eval_walker(Node *node, QualCost *total);
+static bool cost_qual_eval_walker(Node *node, void *total);
 static Selectivity approx_selectivity(Query *root, List *quals,
   JoinType jointype);
 static void set_rel_width(Query *root, RelOptInfo *rel);
@@ -1503,8 +1503,10 @@
 }
 
 static bool
-cost_qual_eval_walker(Node *node, QualCost *total)
+cost_qual_eval_walker(Node *node, void *context)
 {
+   QualCost *total = context;
+
if (node == NULL)
return false;
 
Index: src/backend/optimizer/plan/setrefs.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/optimizer/plan/setrefs.c,v
retrieving revision 1.99
diff -u -b -r1.99 setrefs.c
--- src/backend/optimizer/plan/setrefs.c29 Nov 2003 19:51:50 -  1.99
+++ src/backend/optimizer/plan/setrefs.c14 Dec 2003 15:56:39 -
@@ -51,14 +51,12 @@
List *inner_tlist,
Index acceptable_rel,
bool 

[PATCHES] on_proc_exit/on_shmem_exit prototypes.

2003-12-09 Thread Kurt Roeckx
This patch properly sets the prototype for the on_shmem_exit and
on_proc_exit functions, and adjust all other related code to use
the proper types too.



Kurt

Index: src/backend/access/transam/xlog.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/access/transam/xlog.c,v
retrieving revision 1.126
diff -u -r1.126 xlog.c
--- src/backend/access/transam/xlog.c   29 Nov 2003 19:51:40 -  1.126
+++ src/backend/access/transam/xlog.c   9 Dec 2003 21:08:37 -
@@ -3086,7 +3086,7 @@
  * This must be called ONCE during postmaster or standalone-backend shutdown
  */
 void
-ShutdownXLOG(void)
+ShutdownXLOG(int code, Datum arg)
 {
ereport(LOG,
(errmsg(shutting down)));
Index: src/backend/bootstrap/bootstrap.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/bootstrap/bootstrap.c,v
retrieving revision 1.169
diff -u -r1.169 bootstrap.c
--- src/backend/bootstrap/bootstrap.c   1 Dec 2003 22:15:37 -   1.169
+++ src/backend/bootstrap/bootstrap.c   9 Dec 2003 21:08:38 -
@@ -478,8 +478,8 @@
proc_exit(0);   /* done */
 
case BS_XLOG_SHUTDOWN:
-   ShutdownXLOG();
-   DumpFreeSpaceMap();
+   ShutdownXLOG(0, 0);
+   DumpFreeSpaceMap(0, 0);
proc_exit(0);   /* done */
 
default:
Index: src/backend/catalog/namespace.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/catalog/namespace.c,v
retrieving revision 1.59
diff -u -r1.59 namespace.c
--- src/backend/catalog/namespace.c 29 Nov 2003 19:51:45 -  1.59
+++ src/backend/catalog/namespace.c 9 Dec 2003 21:08:39 -
@@ -130,7 +130,7 @@
 static void recomputeNamespacePath(void);
 static void InitTempTableNamespace(void);
 static void RemoveTempRelations(Oid tempNamespaceId);
-static void RemoveTempRelationsCallback(void);
+static void RemoveTempRelationsCallback(int code, Datum arg);
 static void NamespaceCallback(Datum arg, Oid relid);
 
 /* These don't really need to appear in any header file */
@@ -1735,7 +1735,7 @@
  * Callback to remove temp relations at backend exit.
  */
 static void
-RemoveTempRelationsCallback(void)
+RemoveTempRelationsCallback(int code, Datum arg)
 {
if (OidIsValid(myTempNamespace))/* should always be true */
{
Index: src/backend/commands/async.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/async.c,v
retrieving revision 1.105
diff -u -r1.105 async.c
--- src/backend/commands/async.c29 Nov 2003 19:51:47 -  1.105
+++ src/backend/commands/async.c9 Dec 2003 21:08:39 -
@@ -120,7 +120,7 @@
 
 
 static void Async_UnlistenAll(void);
-static void Async_UnlistenOnExit(void);
+static void Async_UnlistenOnExit(int code, Datum arg);
 static void ProcessIncomingNotify(void);
 static void NotifyMyFrontEnd(char *relname, int32 listenerPID);
 static bool AsyncExistsPendingNotify(const char *relname);
@@ -384,7 +384,7 @@
  *--
  */
 static void
-Async_UnlistenOnExit(void)
+Async_UnlistenOnExit(int code, Datum arg)
 {
/*
 * We need to start/commit a transaction for the unlisten, but if
Index: src/backend/libpq/pqcomm.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/libpq/pqcomm.c,v
retrieving revision 1.167
diff -u -r1.167 pqcomm.c
--- src/backend/libpq/pqcomm.c  29 Nov 2003 19:51:49 -  1.167
+++ src/backend/libpq/pqcomm.c  9 Dec 2003 21:08:40 -
@@ -88,7 +88,7 @@
 #include storage/ipc.h
 
 
-static void pq_close(void);
+static void pq_close(int code, Datum arg);
 
 #ifdef HAVE_UNIX_SOCKETS
 static int Lock_AF_UNIX(unsigned short portNumber, char *unixSocketName);
@@ -145,7 +145,7 @@
  * 
  */
 static void
-pq_close(void)
+pq_close(int code, Datum arg)
 {
if (MyProcPort != NULL)
{
@@ -183,7 +183,7 @@
  */
 #ifdef HAVE_UNIX_SOCKETS
 static void
-StreamDoUnlink(void)
+StreamDoUnlink(int code, Datum arg)
 {
Assert(sock_path[0]);
unlink(sock_path);
Index: src/backend/port/ipc_test.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/port/ipc_test.c,v
retrieving revision 1.11
diff -u -r1.11 ipc_test.c
--- src/backend/port/ipc_test.c 29 Nov 2003 19:51:54 -  1.11
+++ src/backend/port/ipc_test.c 9 Dec 2003 21:08:40 -
@@ -62,7 +62,7 @@
 
 static struct ONEXIT
 {
-   void(*function) ();
+   void(*function) (int code, Datum arg);
Datum   arg;
 }  

Re: [PATCHES] 7.4 shared memory error on 64-bit SPARC/Solaris 5.8

2003-12-02 Thread Kurt Roeckx
creating template1 database in
/export/home/tbaden/posttemp/postgresql-7.4/src/test/regress/./tmp_check/data/b+ase/1...
FATAL:  could not create semaphores: No space left on device
DETAIL:  Failed system call was semget(1, 17, 03600).
HINT:  This error does *not* mean that you have run out of disk space.
It occurs when either the system limit for the maximum number of
semaphore sets (SEMMNI), or the system wide maximum number of semaphores
(SEMMNS), would be exceeded.  You need to raise the respective kernel
parameter.  Alternatively, reduce PostgreSQL's consumption of semaphores by
reducing its max_connections parameter (currently 10).


semget() is about semaphores, not shared memory.


If that really was the error you got, your patch couldn't have
fixed it since it didn't change anything that has something to do
with it.

Did you read the documentation on how to raise those limits, and
raise them?  (Not sure if it's needed for 2.8)


Kurt


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


Re: [PATCHES] 7.4 shared memory error on 64-bit SPARC/Solaris 5.8

2003-12-01 Thread Kurt Roeckx
On Mon, Dec 01, 2003 at 05:19:17PM -0500, Tom Lane wrote:
 Thomas Baden [EMAIL PROTECTED] writes:
  Hi there.  My install was failing the regression tests
  due to a shared memory error.
 
 After reviewing the proposed patch, I find it hard to believe that the
 patch would have fixed any such problem --- even if key_t is 64 bits
 on your system, the code should still have worked, because we'd never
 have selected a key value wider than 32 bits anyway.  What *exact*
 misbehavior were you seeing?

It's not the key (key_t) that is the problem, but the size, which
used to be int but got replaced by a size_t.


Kurt


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


Re: [PATCHES] file too large, segmentation fault

2003-11-28 Thread Kurt Roeckx
On Sun, Nov 23, 2003 at 10:51:10PM -0500, Anjan Dave wrote:
 Hi All:
  
 I am trying to restore a database on a different machine (7.2.3 on Sol9 to 7.2.4 
 RH8), and i get the following error, that i haven't seen before:
  
 -bash-2.05b$ pg_restore -d access -Ft -a access.dump.tar
 pg_restore: [tar archiver] could not open TOC file for input: File too large
 Segmentation fault
 -bash-2.05b$
 
 -bash-2.05b$ ls -l
 total 2339148
 -rw-r--r--1 root root 2323785216 Nov 23 22:43 access.dump.tar

The problem is that your file is over 2 GB, your OS/libc has a
problem opening such big files (using fopen()).

Try cat access.dump.tar | pg_restore -d access -Ft -a

 I read somewhere that there's a patch for this:
 http://dbforums.com/arch/173/2003/1/675653
  
 Will this patch fix it? Where do i get it from and how do i apply it?

The patch only fixed that segmentation fault, not the File too
large.


Kurt


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


Re: [pgsql-hackers-win32] [PATCHES] SRA Win32 sync() code

2003-11-19 Thread Kurt Roeckx
On Mon, Nov 17, 2003 at 12:46:34AM -0500, Bruce Momjian wrote:
 Tom Lane wrote:
   Do we know that having the background writer fsync a file that was
   written by a backend cause all the data to fsync?  I think I could write
   a program to test this by timing each of these tests:
  
  That might prove something about the particular platform you tested it
  on; but it would not speak to the real problem, which is what we can
  assume is true on every platform...
 
 The attached program does test if fsync can be used on a file descriptor
 after the file is closed and then reopened.  I see:
   
   write  0.000613
   write  fsync  0.001727
   write, close  fsync   0.001633

 Does anyone have a platform where the last duration is significantly
 different from the middle timing?

write  0.002807
write  fsync  0.015248
write, close  fsync   0.004696

This is a Linux 2.6.0-test5 on an old IDE disk.

The results change alot.  An other result shows:
write  0.002737
write  fsync  0.006658
write, close  fsync   0.008431

The first time is stable, the other 2 aren't.

Averagly write  fsync would be about twice as big/slow as write,
close  fsync.


PS: Please specify some modes when creating files.

Kurt


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


Re: [PATCHES] SIGPIPE handling

2003-11-16 Thread Kurt Roeckx
On Sun, Nov 16, 2003 at 06:28:06PM +0100, Kurt Roeckx wrote:
 On Sun, Nov 16, 2003 at 12:56:10PM +0100, Manfred Spraul wrote:
  Hi,
  
  attached is an update of my automatic sigaction patch: I've moved the 
  actual sigaction calls into pqsignal.c and added a helper function 
  (pgsignalinquire(signo)). I couldn't remove the include signal.h from 
  fe-connect.c: it's required for the SIGPIPE definition.
  Additionally I've added a -a flag for pgbench that sets the signal 
  handler before calling PQconnectdb.
 
 Is there a reason we don't make use of the MSG_NOSIGNAL flag to
 send()?  Or is the problem in case of SSL?

Oh, seems to be a Linux only thing?


Kurt


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


Re: [PATCHES] IPV4 addresses on IPV6 machines in pg_hba.conf

2003-09-04 Thread Kurt Roeckx
On Wed, Sep 03, 2003 at 07:19:16PM +0200, Andreas Pflug wrote:
 This was discussed in [HACKERS] TCP/IP with 7.4 beta2 broken?
 
 
 I created a patch to hba.c which uses IPV4 entries as IPV6 entries if 
 running on a IPV6 system (which is detected from a port coming in as
 AF_INET6).
 

You're assuming all systems have an AF_INET6 constant, which is
not the case.  Please make use of HAVE_IPV6.

Can't directly see anything else wrong with it.


Kurt


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

   http://archives.postgresql.org


Re: [PATCHES] IPv6 patch doesn't work fine

2003-06-28 Thread Kurt Roeckx
On Thu, Jun 26, 2003 at 08:02:01AM -0400, Kris Jurka wrote:
 
 
 On Thu, 26 Jun 2003, Manuel Gil [iso-8859-1] PĂ©rez wrote:
 
  Hi all.
 
  I have a Java application that it connects to the PostgreSQL database with
  IPv6 patch installed.
 
 What exactly do you have for the URL in the first argument to
 getConnection?  If you have a direct IPv6 address like
 jdbc:postgresql://::1 it will not work at the moment because it tries to
 parse the url using the colon as a delimiter which works fine for IPv4
 addresses, but not IPv6 see org.postgresql.Driver#parseURL for more info.
 
 What happens if you are using a name that resolves to an IPv6 address?
 You're probably the first person to actually try this.  I will look into
 this further, but it may take me a while to get IPv6 up and running on my
 machine.

Did you get it working yet?


Kurt


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

   http://archives.postgresql.org