[PATCHES] updateable cursors

2003-07-26 Thread Gavin Sherry
Attached is a patch implementing updatable cursors in HEAD. Regression
test and documentation are included.

Updateable cursors are used as follows:

begin;
declare foo cursor for select * from bar for update;
fetch foo;
update bar set abc='def' where current of foo;
fetch foo;
delete from bar where current of foo;
commit;


Two points:

i) The patch doesn't implement updateable cursors for cursors marked WITH
HOLD. I have working code for this and will send it in soon.

ii) I've implemented a new snapshot type since, AFAICT, updateable cursors
have a type of tuple visibility. Namely, if the base table of a cursor is
updated based on that cursor, the new and old tuples are removed from the
cursor's set of visible tuples. Like wise, deleted tuples are also
removed.

Thanks,

Gavin


wherecur2.diff.gz
Description: GNU Zip compressed data

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


Re: [PATCHES] sslmode patch

2003-07-26 Thread Bruce Momjian

Newest patch applied.  Thanks.

---



Jon Jensen wrote:
 Folks,
 
 At long last I put together a patch to support 4 client SSL negotiation
 modes (and replace the requiressl boolean). The four options were first
 spelled out by Magnus Hagander [EMAIL PROTECTED] on 2000-08-23 in email
 to pgsql-hackers, archived here:
 
 http://archives.postgresql.org/pgsql-hackers/2000-08/msg00639.php
 
 My original less-flexible patch and the ensuing thread are archived at:
 
 http://dbforums.com/t623845.html
 
 Attached is a new patch, including documentation.
 
 To sum up, there's a new client parameter sslmode and environment 
 variable PGSSLMODE, with these options:
 
 sslmode   description
 ---   ---
 disable   Unencrypted non-SSL only
 allow Negotiate, prefer non-SSL
 preferNegotiate, prefer SSL (default)
 require   Require SSL
 
 The only change to the server is a new pg_hba.conf line type,
 hostnossl, for specifying connections that are not allowed to use SSL
 (for example, to prevent servers on a local network from accidentally
 using SSL and wasting cycles). Thus the 3 pg_hba.conf line types are:
 
 pg_hba.conf line types
 --
 host   applies to either SSL or regular connections
 hostsslapplies only to SSL connections
 hostnossl  applies only to regular connections
 
 These client and server options, the postgresql.conf ssl = false option,
 and finally the possibility of compiling with no SSL support at all,
 make quite a range of combinations to test. I threw together a test
 script to try many of them out. It's in a separate tarball with its
 config files, a patch to psql so it'll announce SSL connections even in
 absence of a tty, and the test output. The test is especially informative 
 when run on the same tty the postmaster was started on, so the FATAL: 
 errors during negotiation are interleaved with the psql client output.
 
 I saw Tom write that new submissions for 7.4 have to be in before midnight
 local time, and since I'm on the east coast in the US, this just makes it
 in before the bell. :)
 
 Jon

Content-Description: 

[ Attachment, skipping... ]

Content-Description: 

[ Attachment, skipping... ]

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

-- 
  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 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [PATCHES] Revised sslmode patch

2003-07-26 Thread Bruce Momjian

This is the actual patch applied.

---

Jon Jensen wrote:
 Hi.
 
 This is a revised patch for the sslmode functionality. It fixes bugs in 
 both documentation and code, and adds a few more tests. Please discard my 
 previous patch.
 
 Thanks,
 Jon

Content-Description: 

[ Attachment, skipping... ]

Content-Description: 

[ Attachment, skipping... ]

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

-- 
  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 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [PATCHES] timestamp date_trunc('quarter',...)

2003-07-26 Thread Bruce Momjian

Patch applied.  Thanks.

---



Böjthe Zoltán wrote:
 I corecting date_trunc('quarter',...) and friends because orig version 
 doing '2003-07-30' - '2003-04-01', '2003-11-30' -'2003-07-01'

 --- src/backend/utils/adt/timestamp.c
 +++ src/backend/utils/adt/timestamp.c
 @@ -2412,7 +2412,7 @@
   case DTK_YEAR:
   tm-tm_mon = 1;
   case DTK_QUARTER:
 - tm-tm_mon = (3 * (tm-tm_mon / 4)) + 1;
 + tm-tm_mon = (3 * ((tm-tm_mon - 1) / 3)) + 1;
   case DTK_MONTH:
   tm-tm_mday = 1;
   case DTK_DAY:
 @@ -2505,7 +2505,7 @@
   case DTK_YEAR:
   tm-tm_mon = 1;
   case DTK_QUARTER:
 - tm-tm_mon = (3 * (tm-tm_mon / 4)) + 1;
 + tm-tm_mon = (3 * ((tm-tm_mon - 1) / 3)) + 1;
   case DTK_MONTH:
   tm-tm_mday = 1;
   case DTK_DAY:
 @@ -2598,7 +2598,7 @@
   case DTK_YEAR:
   tm-tm_mon = 0;
   case DTK_QUARTER:
 - tm-tm_mon = (3 * (tm-tm_mon / 4));
 + tm-tm_mon = (3 * (tm-tm_mon / 3));
   case DTK_MONTH:
   tm-tm_mday = 0;
   case DTK_DAY:
 @@ -3175,7 +3175,7 @@
   break;
  
   case DTK_QUARTER:
 - result = (tm-tm_mon / 4) + 1;
 + result = (tm-tm_mon / 3) + 1;
   break;
  
   case DTK_YEAR:

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

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


Re: [PATCHES] fix linux startup script

2003-07-26 Thread Bruce Momjian

Thanks. Patch applied.

---

Slawomir Sudnik wrote:
 Hi,
 
 Linux startuap script  doesn't  work.
 This patch correct linux startup script.
 
 Index: linux
 ===
 RCS file: /projects/cvsroot/pgsql-server/contrib/start-scripts/linux,v
 retrieving revision 1.4
 diff -u -r1.4 linux
 @@ -83,6 +83,7 @@
  echo -n Reload PostgreSQL: 
  su - $PGUSER -c $DAEMON reload -D '$PGDATA' -s
  echo ok
 + ;;
status)
   su - $PGUSER -c $DAEMON status -D '$PGDATA'
   ;;
 
 Regards,
 Slawomir Sudnik
 

-- 
  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 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [PATCHES] fix for plpgsql polymorphism

2003-07-26 Thread Bruce Momjian

Patch applied.  Thanks.

---



Joe Conway wrote:
 Tom Lane wrote:
 You can alias $0, similar to the argument variables. And, I confirmed 
 that you cannot change the value, similar to the argument variables:
  
  Perhaps you shouldn't mark it isconst; then it would actually have some
  usefulness (you could use it directly as a temporary variable to hold
  the intended result).  I can't see much value in aliasing it if it's
  const, either.
 
 OK; the only change in this version is isconst = false;. Now you can 
 use $0 as a result placeholder if desired. E.g.:
 
 create or replace function tmp(anyelement, anyelement) returns anyarray as '
 declare
   v_ret alias for $0;
   v_el1 alias for $1;
   v_el2 alias for $2;
 begin
   v_ret := ARRAY[v_el1, v_el2];
   return v_ret;
 end;
 ' language 'plpgsql';
 
 create table f(f1 text, f2 text, f3 int, f4 int);
 insert into f values ('a','b',1,2);
 insert into f values ('z','x',3,4);
 
 select tmp(f1,f2) from f;
 select tmp(f3,f4) from f;
 
 Joe

 Index: src/pl/plpgsql/src/pl_comp.c
 ===
 RCS file: /opt/src/cvs/pgsql-server/src/pl/plpgsql/src/pl_comp.c,v
 retrieving revision 1.59
 diff -c -r1.59 pl_comp.c
 *** src/pl/plpgsql/src/pl_comp.c  1 Jul 2003 21:47:09 -   1.59
 --- src/pl/plpgsql/src/pl_comp.c  3 Jul 2003 17:59:48 -
 ***
 *** 354,359 
 --- 354,395 
   function-fn_rettyplen = typeStruct-typlen;
   function-fn_rettypelem = typeStruct-typelem;
   perm_fmgr_info(typeStruct-typinput, 
 (function-fn_retinput));
 + 
 + /*
 +  * install $0 reference, but only for polymorphic
 +  * return types
 +  */
 + if (procStruct-prorettype == ANYARRAYOID ||
 + procStruct-prorettype == ANYELEMENTOID)
 + {
 + charbuf[32];
 + 
 + /* name for variable */
 + snprintf(buf, sizeof(buf), $%d, 0);
 + 
 + /*
 +  * Normal return values get a var node
 +  */
 + var = malloc(sizeof(PLpgSQL_var));
 + memset(var, 0, sizeof(PLpgSQL_var));
 + 
 + var-dtype = PLPGSQL_DTYPE_VAR;
 + var-refname = strdup(buf);
 + var-lineno = 0;
 + var-datatype = build_datatype(typeTup, -1);
 + var-isconst = false;
 + var-notnull = false;
 + var-default_val = NULL;
 + 
 + /* preset to NULL */
 + var-value = 0;
 + var-isnull = true;
 + var-freeval = false;
 + 
 + plpgsql_adddatum((PLpgSQL_datum *) var);
 + plpgsql_ns_additem(PLPGSQL_NSTYPE_VAR, 
 var-varno,
 +
 var-refname);
 + }
   }
   ReleaseSysCache(typeTup);
   

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

-- 
  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 8: explain analyze is your friend


Re: [PATCHES] An additional foreign key test for regression

2003-07-26 Thread Bruce Momjian

Patch applied.  Thanks.

I adjusted the patch to match the new elog output.

---


Stephan Szabo wrote:
 
 The deferred trigger queue pushing to disk patch pointed out
 that the regression tests for foreign keys didn't seem to test
 a deferred constraint that was not satisified by a later
 statement and was not made immediate by set constraints,
 so here's a simple added test with a single invalid insert and
 a commit.

Content-Description: 

[ Attachment, skipping... ]

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

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


Re: [PATCHES] patch for Oracle initcap compatibility

2003-07-26 Thread Bruce Momjian

Patch applied.  Thanks.

---



[EMAIL PROTECTED] wrote:
 This makes the initcap function compatible with Oracle 9i, it has been
 tested on both redhat 8 and FreebSD.
 --
 Mike Nolan
 
 RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/adt/oracle_compat.c,v
 retrieving revision 1.44
 diff -c -r1.44 oracle_compat.c
 *** oracle_compat.c 23 May 2003 22:33:20 -  1.44
 --- oracle_compat.c 17 Jul 2003 08:03:41 -
 ***
 *** 132,138 
 
while (m--  0)
{
 !   if (isspace((unsigned char) ptr[-1]))
*ptr = toupper((unsigned char) *ptr);
else
*ptr = tolower((unsigned char) *ptr);
 --- 132,139 
 
while (m--  0)
{
 !   /* Oracle capitalizes after all non-alphanumeric */
 !   if (!isalnum((unsigned char) ptr[-1]))
*ptr = toupper((unsigned char) *ptr);
else
*ptr = tolower((unsigned char) *ptr);
 
 
 ---(end of broadcast)---
 TIP 8: explain analyze is your friend
 

-- 
  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 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])


Re: [PATCHES] psql patches for win32

2003-07-26 Thread Bruce Momjian

Patch applied.  Thanks.

---

Christoph Dalitz wrote:
 Hello Bruce,
 
 here are the patches for psql on Win32:
 
   psql4win32.patch  - changes in the psql source code
   psql-ref.patch- changes in the documentation psql-ref.sgml
   (for new builtin variable WIN32_CONSOLE)
 
 To apply them use patch -p 1 in the root directory of the
 postgres source directory.
 
 If you are not the right adressee for these patches, please let me
 know whom I can send them instead.
 
 These patches fix the following problems of psql on Win32
 (all changes only have effect #ifdef WIN32):
 
   a) Problem:  Static library libpq.a did not work
  Solution: Added WSAStartup() in fe-connect.c
 
   b) Problem:  Secret Password was echoed by psql
  Solution: Password echoing disabled in sprompt.c
 
   c) Problem:  8bit characters were displayed/interpreted wrong in psql
This is due to the fact that the Win32 console uses a
different encoding than the rest of the Windows system
  Solution: Introduced a new psql variable WIN32_CONSOLE
When set with \set WIN32_console, the function OemToChar()
is applied after reading input and CharToOem() before
displaying Output
 
 Christoph Dalitz
 
 PS: How was your talk at LinuxTag?
 Was there strong interest in PostgreSQL?

[ Attachment, skipping... ]

[ Attachment, skipping... ]

-- 
  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 8: explain analyze is your friend


Re: [PATCHES] nitpick consistency patch for pg_dump.c

2003-07-26 Thread Bruce Momjian

Newer patch applied.  Thanks.

---



Andrew Dunstan wrote:
 
 This is a totally trivial patch for something that was a very minor nit that
 annoyed me the other day while I was documenting my current project. It
 makes pg_dump use the same layout for types as for tables, by putting \n\t
 before the first field and \n before the final );
 
 Can't really justify this too much except to say I had an itch and I
 scratched it ;-)
 
 cheers
 
 andrew
 
 
 
 *** pg_dump.c~  2003-06-25 00:08:19.0 -0400
 --- pg_dump.c   2003-07-17 15:34:52.0 -0400
 ***
 *** 3412,3418 
 i_attname = PQfnumber(res, attname);
 i_atttypdefn = PQfnumber(res, atttypdefn);
 
 !   appendPQExpBuffer(q, CREATE TYPE %s AS (,
   fmtId(tinfo-typname));
 
 for (i = 0; i  ntups; i++)
 --- 3412,3418 
 i_attname = PQfnumber(res, attname);
 i_atttypdefn = PQfnumber(res, atttypdefn);
 
 !   appendPQExpBuffer(q, CREATE TYPE %s AS (\n,
   fmtId(tinfo-typname));
 
 for (i = 0; i  ntups; i++)
 ***
 *** 3423,3433 
 attname = PQgetvalue(res, i, i_attname);
 atttypdefn = PQgetvalue(res, i, i_atttypdefn);
 
 !   if (i  0)
 !   appendPQExpBuffer(q, ,\n\t);
 !   appendPQExpBuffer(q, %s %s, fmtId(attname), atttypdefn);
 }
 !   appendPQExpBuffer(q, );\n);
 
 /*
  * DROP must be fully qualified in case same name appears in
 --- 3423,3431 
 attname = PQgetvalue(res, i, i_attname);
 atttypdefn = PQgetvalue(res, i, i_atttypdefn);
 
 !   appendPQExpBuffer(q, \n\t%s %s, fmtId(attname),
 atttypdefn);}
 !   appendPQExpBuffer(q, \n);\n);
 
 /*
  * DROP must be fully qualified in case same name appears in
 
 
 
 
 
 
 
 ---(end of broadcast)---
 TIP 2: you can get off all lists at once with the unregister command
 (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
 

-- 
  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 8: explain analyze is your friend


Re: [PATCHES] nitpick consistency patch for pg_dump.c

2003-07-26 Thread Bruce Momjian

This was the actual patch applied.

---

Andrew Dunstan wrote:
 
 trivial or not the patch was broken. *sigh*. it's been a long day.
 
 This patch will work.
 
 sorry
 
 andrew
 
 RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_dump/pg_dump.c,v
 retrieving revision 1.335
 diff -c -w -r1.335 pg_dump.c
 *** pg_dump.c   25 Jun 2003 04:08:19 -  1.335
 --- pg_dump.c   18 Jul 2003 21:14:34 -
 ***
 *** 3423,3433 
 attname = PQgetvalue(res, i, i_attname);
 atttypdefn = PQgetvalue(res, i, i_atttypdefn);
 
 !   if (i  0)
 !   appendPQExpBuffer(q, ,\n\t);
 !   appendPQExpBuffer(q, %s %s, fmtId(attname), atttypdefn);
 }
 !   appendPQExpBuffer(q, );\n);
 
 /*
  * DROP must be fully qualified in case same name appears in
 --- 3423,3433 
 attname = PQgetvalue(res, i, i_attname);
 atttypdefn = PQgetvalue(res, i, i_atttypdefn);
 
 !   appendPQExpBuffer(q, \n\t%s %s, fmtId(attname),
 atttypdefn);!   if (i  ntups - 1)
 !   appendPQExpBuffer(q, ,);
 }
 !   appendPQExpBuffer(q, \n);\n);
 
 /*
  * DROP must be fully qualified in case same name appears in
 
 
 
 
  This is a totally trivial patch for something that was a very minor nit
  that annoyed me the other day while I was documenting my current
  project. It makes pg_dump use the same layout for types as for tables,
  by putting \n\t before the first field and \n before the final );
 
  Can't really justify this too much except to say I had an itch and I
  scratched it ;-)
 
 
 
 
 
 ---(end of broadcast)---
 TIP 7: don't forget to increase your free space map settings
 

-- 
  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 4: Don't 'kill -9' the postmaster


Re: [PATCHES] [NOVICE] connectby(... pos_of_sibling)

2003-07-26 Thread Bruce Momjian

Patch applied.  Thanks.

---


Joe Conway wrote:
 I'm going to resend the patches that I have outstanding since it appears 
 some may have been lost. Here's the second of three.
 
 
 
 Nabil Sayegh wrote:
  Am Son, 2003-06-22 um 02.09 schrieb Joe Conway:
 Sounds like all that's needed for your case. But to be complete, in 
 addition to changing tablefunc.c we'd have to:
 1) come up with a new function call signature that makes sense and does 
 not cause backward compatibility problems for other people
 2) make needed changes to tablefunc.sql.in
 3) adjust the README.tablefunc appropriately
 4) adjust the regression test for new functionality
 5) be sure we don't break any of the old cases
 
 If you want to submit a complete patch, it would be gratefully accepted 
 -- for review at least ;-)
  
  Here's the patch, at least for steps 1-3
  I don't know anything about regression tests :(
  
  However, I included a patch against 7.3.3
  
 
 Nice work Nabil!
 
 I've merged the patch with cvs HEAD, added to the regression tests, and
 verified no backward compatibility issues. Please apply.
 
 FYI Nabil, if you want to run the regression test, cd to
 contrib/tablefunc as user postgres (or whoever postgresql runs as, and
 be sure they have full permission on contrib/tablefunc directory) and run:
 
 make installcheck
 
 The test script that gets run is in contrib/tablefunc/sql, the expected
 output is in contrib/tablefunc/expected, and the actual output is in
 contrib/tablefunc/results. If the test fails you'll find regression.diff
 in contrib/tablefunc.
 
 I'll send you a tarred copy of contrib/tablefunc (off list) to try
 yourself on 7.3.3, as I don't think this patch will apply cleanly to it.
 It ought to work on 7.3.3, and it includes enhance crosstab functionality.
 
 Thanks!
 
 Joe
 

 Index: contrib/tablefunc/README.tablefunc
 ===
 RCS file: /opt/src/cvs/pgsql-server/contrib/tablefunc/README.tablefunc,v
 retrieving revision 1.6
 diff -c -r1.6 README.tablefunc
 *** contrib/tablefunc/README.tablefunc20 Mar 2003 06:46:30 -  1.6
 --- contrib/tablefunc/README.tablefunc26 Jun 2003 16:44:17 -
 ***
 *** 4,9 
 --- 4,11 
* Sample to demonstrate C functions which return setof scalar
* and setof composite.
* Joe Conway [EMAIL PROTECTED]
 +  * And contributors:
 +  * Nabil Sayegh [EMAIL PROTECTED]
*
* Copyright 2002 by PostgreSQL Global Development Group
*
 ***
 *** 60,68 
 - requires anonymous composite type syntax in the FROM clause. See
   the instructions in the documentation below.
   
 ! connectby(text relname, text keyid_fld, text parent_keyid_fld,
 ! text start_with, int max_depth [, text branch_delim])
 - returns keyid, parent_keyid, level, and an optional branch string
 - requires anonymous composite type syntax in the FROM clause. See
   the instructions in the documentation below.
   
 --- 62,72 
 - requires anonymous composite type syntax in the FROM clause. See
   the instructions in the documentation below.
   
 ! connectby(text relname, text keyid_fld, text parent_keyid_fld
 ! [, text orderby_fld], text start_with, int max_depth
 ! [, text branch_delim])
 - returns keyid, parent_keyid, level, and an optional branch string
 + and an optional serial column for ordering siblings
 - requires anonymous composite type syntax in the FROM clause. See
   the instructions in the documentation below.
   
 ***
 *** 452,464 
   ==
   Name
   
 ! connectby(text, text, text, text, int[, text]) - returns a set
   representing a hierarchy (tree structure)
   
   Synopsis
   
 ! connectby(text relname, text keyid_fld, text parent_keyid_fld,
 ! text start_with, int max_depth [, text branch_delim])
   
   Inputs
   
 --- 456,469 
   ==
   Name
   
 ! connectby(text, text, text[, text], text, text, int[, text]) - returns a set
   representing a hierarchy (tree structure)
   
   Synopsis
   
 ! connectby(text relname, text keyid_fld, text parent_keyid_fld
 ! [, text orderby_fld], text start_with, int max_depth
 ! [, text branch_delim])
   
   Inputs
   
 ***
 *** 474,479 
 --- 479,489 
   
   Name of the key_parent field
   
 +   orderby_fld
 + 
 + If optional ordering of siblings is desired:
 + Name of the field to order siblings
 + 
 start_with
   
   root value of the tree input as a text value 

Re: [PATCHES] timetravel.c

2003-07-26 Thread Bruce Momjian

Patch applied.  Thanks.

---


Böjthe Zoltán wrote:
 Bruce Momjian ?rta:
 
 Great.  Please send over the file as an attachment and I will see that
 it is added, or even better, use diff -c against the 7.3.2 version and
 your new version so we can see the changes.
 
 ---
 
   
 
 Hi!
 
 Here is 4 file in tgz:
 the new timetravel.c,
 new timetravel.README (cut from spi/README and modified),
 modified timetravel.sql.in
 and modified timetravel.example.
 
 Features:
 - optionally 3 parameter for insert/update/delete user name
 
 - work with CREATE UNIQUE INDEX ixxx on table xxx (unique_field,time_off);
 (the  original version was work with unique index on 6.5.0-6.5.3, 
 and not work on 7.3.2,7.3.3)
  (before 6.5.0 and between 6.5.3 and 7.3.2 I dont know)
 
 - get_timetravel(tablename) function for check timetravel-status.
 
 - timetravel trigger not change  oid of the active record. (it is not a 
 good feature, because the  old version is automatice prevent the paralel 
 update with where oid=nnn)
 

[ application/x-gtar is not supported, skipping... ]

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

-- 
  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 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: [HACKERS] [PATCHES] PATCH: Memory leaks on start-up

2003-07-26 Thread Bruce Momjian

This patch no longer applies cleanly.  The call is now:

freeaddrinfo_all(hint.ai_family, addrs);

Would you please submit a new patch, or is it no longer required?  There
were two fixed in your patch.

Thanks.

---

Lee Kindness wrote:
Content-Description: message body text

 Tom, happier with the attached patch?
 
 I'd have to disagree with regards to the memory leaks not being worth
 a mention - any such leak can cause problems when the PostgreSQL
 installation is either unattended, long-living andor has very high
 connection levels. Half a kilobyte on start-up isn't negligible in
 this light.
 
 Regards, Lee.
 
 Tom Lane writes:
   Lee Kindness [EMAIL PROTECTED] writes:
Guys, attached is a patch to fix two memory leaks on start-up.
   
   I do not like the changes to miscinit.c.  In the first place, it is not
   a memory leak to do a one-time allocation of state for a proc_exit
   function.  A bigger complaint is that your proposed change introduces
   fragile coupling between CreateLockFile and its callers, in order to
   save no resources worth mentioning.  More, it introduces an assumption
   that the globals directoryLockFile and socketLockFile don't change while
   the postmaster is running.  UnlinkLockFile should unlink the file that
   it was originally told to unlink, regardless of what happens to those
   globals.
   
   If you are intent on spending code to free stuff just before the
   postmaster exits, a better fix would be for UnlinkLockFile to free its
   string argument after using it.
 

 Index: src/backend/libpq/pqcomm.c
 ===
 RCS file: /projects/cvsroot/pgsql-server/src/backend/libpq/pqcomm.c,v
 retrieving revision 1.157
 diff -u -r1.157 pqcomm.c
 --- src/backend/libpq/pqcomm.c12 Jun 2003 07:36:51 -  1.157
 +++ src/backend/libpq/pqcomm.c22 Jul 2003 14:16:46 -
 @@ -363,7 +363,7 @@
   added++;
   }
  
 - freeaddrinfo(addrs);
 + freeaddrinfo2(family, addrs);
  
   if (!added)
   {
 Index: src/backend/utils/init/miscinit.c
 ===
 RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/init/miscinit.c,v
 retrieving revision 1.104
 diff -u -r1.104 miscinit.c
 --- src/backend/utils/init/miscinit.c 27 Jun 2003 19:08:37 -  1.104
 +++ src/backend/utils/init/miscinit.c 22 Jul 2003 14:16:46 -
 @@ -673,8 +673,15 @@
  static void
  UnlinkLockFile(int status, Datum filename)
  {
 - unlink((char *) DatumGetPointer(filename));
 - /* Should we complain if the unlink fails? */
 +  char *fname = (char *)DatumGetPointer(filename);
 +  if( fname != NULL )
 +{
 +  if( unlink(fname) != 0 )
 + {
 +   /* Should we complain if the unlink fails? */
 + }
 +  free(fname);
 +}
  }
  
  /*

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

-- 
  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 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html