*** postgresql-6.5.3/src/backend/access/rtree/rtree.c.orig Mon Aug 2 14:24:44 1999 --- postgresql-6.5.3/src/backend/access/rtree/rtree.c Mon May 27 16:19:05 2002 *************** *** 843,849 **** pfree(datum_r); pfree(union_dl); datum_r = union_dr; ! size_r = size_alpha; *right++ = i; v->spl_nright++; } --- 843,849 ---- pfree(datum_r); pfree(union_dl); datum_r = union_dr; ! size_r = size_beta; *right++ = i; v->spl_nright++; } *** postgresql-6.5.3/src/backend/catalog/indexing.c.orig Mon Aug 2 14:56:54 1999 --- postgresql-6.5.3/src/backend/catalog/indexing.c Mon May 27 16:19:05 2002 *************** *** 43,50 **** AttributeNumIndex, AttributeRelidIndex}; char *Name_pg_proc_indices[Num_pg_proc_indices] = {ProcedureNameIndex, ! ProcedureOidIndex, ! ProcedureSrcIndex}; char *Name_pg_type_indices[Num_pg_type_indices] = {TypeNameIndex, TypeOidIndex}; char *Name_pg_class_indices[Num_pg_class_indices] = {ClassNameIndex, --- 43,49 ---- AttributeNumIndex, AttributeRelidIndex}; char *Name_pg_proc_indices[Num_pg_proc_indices] = {ProcedureNameIndex, ! ProcedureOidIndex}; char *Name_pg_type_indices[Num_pg_type_indices] = {TypeNameIndex, TypeOidIndex}; char *Name_pg_class_indices[Num_pg_class_indices] = {ClassNameIndex, *************** *** 373,400 **** index_close(idesc); - return tuple; - } - - - HeapTuple - ProcedureSrcIndexScan(Relation heapRelation, text *procSrc) - { - Relation idesc; - ScanKeyData skey[1]; - HeapTuple tuple; - - ScanKeyEntryInitialize(&skey[0], - (bits16) 0x0, - (AttrNumber) 1, - (RegProcedure) F_TEXTEQ, - PointerGetDatum(procSrc)); - - idesc = index_openr(ProcedureSrcIndex); - tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1); - - index_close(idesc); - return tuple; } --- 372,377 ---- *** postgresql-6.5.3/src/backend/catalog/pg_proc.c.orig Mon Aug 2 14:56:55 1999 --- postgresql-6.5.3/src/backend/catalog/pg_proc.c Mon May 27 16:19:05 2002 *************** *** 131,136 **** --- 131,137 ---- */ if (!strcmp(procedureName, GENERICSETNAME)) { + #ifdef SETS_FIXED prosrctext = textin(prosrc); tup = SearchSysCacheTuple(PROSRC, PointerGetDatum(prosrctext), *************** *** 138,143 **** --- 139,147 ---- pfree(prosrctext); if (HeapTupleIsValid(tup)) return tup->t_data->t_oid; + #else + elog(ERROR, "lookup for procedure by source needs fix (Jan)"); + #endif } } *** postgresql-6.5.3/src/backend/commands/vacuum.c.orig Wed Aug 25 21:01:45 1999 --- postgresql-6.5.3/src/backend/commands/vacuum.c Mon May 27 16:19:05 2002 *************** *** 1026,1031 **** --- 1026,1032 ---- *idcur; int last_fraged_block, last_vacuum_block, + last_moved_in_block, i = 0; Size tuple_len; int num_moved, *************** *** 1061,1066 **** --- 1062,1068 ---- vacuumed_pages = vacuum_pages->vpl_num_pages - vacuum_pages->vpl_empty_end_pages; last_vacuum_page = vacuum_pages->vpl_pagedesc[vacuumed_pages - 1]; last_vacuum_block = last_vacuum_page->vpd_blkno; + last_moved_in_block = 0; Assert(last_vacuum_block >= last_fraged_block); cur_buffer = InvalidBuffer; num_moved = 0; *************** *** 1074,1079 **** --- 1076,1084 ---- /* if it's reapped page and it was used by me - quit */ if (blkno == last_fraged_block && last_fraged_page->vpd_offsets_used > 0) break; + /* couldn't shrink any more if this block has MOVED_IN tuplesit's - quit */ + if (blkno == last_moved_in_block) + break; buf = ReadBuffer(onerel, blkno); page = BufferGetPage(buf); *************** *** 1448,1453 **** --- 1453,1460 ---- pfree(newtup.t_data); newtup.t_data = (HeapTupleHeader) PageGetItem(ToPage, newitemid); ItemPointerSet(&(newtup.t_self), vtmove[ti].vpd->vpd_blkno, newoff); + if (vtmove[i].vpd->vpd_blkno > last_moved_in_block) + last_moved_in_block = vtmove[i].vpd->vpd_blkno; /* * Set t_ctid pointing to itself for last tuple in *************** *** 1580,1585 **** --- 1587,1594 ---- newtup.t_data = (HeapTupleHeader) PageGetItem(ToPage, newitemid); ItemPointerSet(&(newtup.t_data->t_ctid), cur_page->vpd_blkno, newoff); newtup.t_self = newtup.t_data->t_ctid; + if (cur_page->vpd_blkno > last_moved_in_block) + last_moved_in_block = cur_page->vpd_blkno; /* * Mark old tuple as moved_off by vacuum and store vacuum XID *************** *** 2405,2414 **** stup = heap_formtuple(sd->rd_att, values, nulls); /* ---------------- ! * insert the tuple in the relation and get the tuple's oid. * ---------------- */ ! heap_insert(sd, stup); pfree(DatumGetPointer(values[3])); pfree(DatumGetPointer(values[4])); pfree(stup); --- 2414,2434 ---- stup = heap_formtuple(sd->rd_att, values, nulls); /* ---------------- ! * Watch out for oversize tuple, which can happen if ! * both of the saved data values are long. ! * Our fallback strategy is just to not store the ! * pg_statistic tuple at all in that case. (We could ! * replace the values by NULLs and still store the ! * numeric stats, but presently selfuncs.c couldn't ! * do anything useful with that case anyway.) * ---------------- */ ! if (MAXALIGN(stup->t_len) <= MaxTupleSize) ! { ! /* OK to store tuple */ ! heap_insert(sd, stup); ! } ! pfree(DatumGetPointer(values[3])); pfree(DatumGetPointer(values[4])); pfree(stup); *** postgresql-6.5.3/src/backend/commands/user.c.orig Mon Aug 2 14:56:59 1999 --- postgresql-6.5.3/src/backend/commands/user.c Mon May 27 16:19:05 2002 *************** *** 46,51 **** --- 46,52 ---- char *filename, *tempname; int bufsize; + int fd; /* * Create a temporary filename to be renamed later. This prevents the *************** *** 75,81 **** * the pg_pwd file contents. */ filename = crypt_getpwdreloadfilename(); ! creat(filename, S_IRUSR | S_IWUSR); } /*--------------------------------------------------------------------- --- 76,84 ---- * the pg_pwd file contents. */ filename = crypt_getpwdreloadfilename(); ! fd = creat(filename, S_IRUSR | S_IWUSR); ! if (fd != -1) ! close(fd); } /*--------------------------------------------------------------------- *** postgresql-6.5.3/src/backend/libpq/password.c.orig Wed May 26 01:09:00 1999 --- postgresql-6.5.3/src/backend/libpq/password.c Mon May 27 16:19:05 2002 *************** *** 91,96 **** --- 91,98 ---- } } + FreeFile(pw_file); + snprintf(PQerrormsg, ERROR_MSG_LENGTH, "verify_password: user '%s' not found in password file.\n", user); *** postgresql-6.5.3/src/backend/storage/lmgr/lock.c.orig Sat May 29 15:14:42 1999 --- postgresql-6.5.3/src/backend/storage/lmgr/lock.c Mon May 27 16:19:05 2002 *************** *** 940,946 **** { PROC_QUEUE *waitQueue = &(lock->waitProcs); LOCKMETHODTABLE *lockMethodTable = LockMethodTable[lockmethod]; ! char old_status[64], new_status[64]; Assert(lockmethod < NumLockMethods); --- 940,946 ---- { PROC_QUEUE *waitQueue = &(lock->waitProcs); LOCKMETHODTABLE *lockMethodTable = LockMethodTable[lockmethod]; ! static char old_status[64], new_status[64]; Assert(lockmethod < NumLockMethods); *** postgresql-6.5.3/src/backend/utils/adt/dt.c.orig Mon Aug 2 14:24:51 1999 --- postgresql-6.5.3/src/backend/utils/adt/dt.c Mon May 27 16:19:05 2002 *************** *** 811,816 **** --- 811,817 ---- * To add a month, increment the month, and use the same day of month. * Then, if the next month has fewer days, set the day of month * to the last day of month. + * Lastly, add in the "quantitative time". */ DateTime * datetime_pl_span(DateTime *datetime, TimeSpan *span) *************** *** 843,854 **** { dt = (DATETIME_IS_RELATIVE(*datetime) ? SetDateTime(*datetime) : *datetime); - #ifdef ROUND_ALL - dt = JROUND(dt + span->time); - #else - dt += span->time; - #endif - if (span->month != 0) { struct tm tt, --- 844,849 ---- *************** *** 889,894 **** --- 884,895 ---- DATETIME_INVALID(dt); } + #ifdef ROUND_ALL + dt = JROUND(dt + span->time); + #else + dt += span->time; + #endif + *result = dt; } *************** *** 2569,2575 **** tm2timespan(struct tm * tm, double fsec, TimeSpan *span) { span->month = ((tm->tm_year * 12) + tm->tm_mon); ! span->time = ((((((tm->tm_mday * 24) + tm->tm_hour) * 60) + tm->tm_min) * 60) + tm->tm_sec); span->time = JROUND(span->time + fsec); #ifdef DATEDEBUG --- 2570,2579 ---- tm2timespan(struct tm * tm, double fsec, TimeSpan *span) { span->month = ((tm->tm_year * 12) + tm->tm_mon); ! span->time = ((((((tm->tm_mday * 24.0) ! + tm->tm_hour) * 60.0) ! + tm->tm_min) * 60.0) ! + tm->tm_sec); span->time = JROUND(span->time + fsec); #ifdef DATEDEBUG *** postgresql-6.5.3/src/backend/utils/adt/name.c.orig Mon Aug 2 14:24:55 1999 --- postgresql-6.5.3/src/backend/utils/adt/name.c Mon May 27 16:19:05 2002 *************** *** 87,93 **** if (!arg1 || !arg2) return 0; else ! return (bool) strncmp(arg1->data, arg2->data, NAMEDATALEN) == 0; } bool --- 87,93 ---- if (!arg1 || !arg2) return 0; else ! return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) == 0); } bool *** postgresql-6.5.3/src/backend/utils/cache/syscache.c.orig Mon Aug 2 14:25:01 1999 --- postgresql-6.5.3/src/backend/utils/cache/syscache.c Mon May 27 16:19:05 2002 *************** *** 335,351 **** offsetof(FormData_pg_rewrite, ev_qual), NULL, (ScanFunc) NULL}, - {ProcedureRelationName, /* PROSRC */ - 1, - { - Anum_pg_proc_prosrc, - 0, - 0, - 0 - }, - offsetof(FormData_pg_proc, prosrc), - ProcedureSrcIndex, - (ScanFunc) ProcedureSrcIndexScan}, {OperatorClassRelationName, /* CLADEFTYPE */ 1, { --- 335,340 ---- *** postgresql-6.5.3/src/backend/utils/init/postinit.c.orig Mon Aug 2 14:25:10 1999 --- postgresql-6.5.3/src/backend/utils/init/postinit.c Mon May 27 16:19:05 2002 *************** *** 572,577 **** --- 572,581 ---- */ InitCatalogCache(); + /* start a new transaction here before access to db */ + if (!bootstrap) + StartTransactionCommand(); + /* ---------------- * set ourselves to the proper user id and figure out our postgres * user id. If we ever add security so that we check for valid *** postgresql-6.5.3/src/backend/utils/mb/conv.c.orig Mon Jul 12 07:47:20 1999 --- postgresql-6.5.3/src/backend/utils/mb/conv.c Mon May 27 16:19:05 2002 *************** *** 605,612 **** else { /* should be ASCII */ *p++ = c1; } - mic++; } *p = '\0'; } --- 605,612 ---- else { /* should be ASCII */ *p++ = c1; + mic++; } } *p = '\0'; } *** postgresql-6.5.3/src/include/catalog/indexing.h.orig Sun Feb 14 08:21:03 1999 --- postgresql-6.5.3/src/include/catalog/indexing.h Mon May 27 16:19:05 2002 *************** *** 21,27 **** * Some definitions for indices on pg_attribute */ #define Num_pg_attr_indices 3 ! #define Num_pg_proc_indices 3 #define Num_pg_type_indices 2 #define Num_pg_class_indices 2 #define Num_pg_attrdef_indices 1 --- 21,27 ---- * Some definitions for indices on pg_attribute */ #define Num_pg_attr_indices 3 ! #define Num_pg_proc_indices 2 #define Num_pg_type_indices 2 #define Num_pg_class_indices 2 #define Num_pg_attrdef_indices 1 *************** *** 38,44 **** #define AttributeRelidIndex "pg_attribute_attrelid_index" #define ProcedureOidIndex "pg_proc_oid_index" #define ProcedureNameIndex "pg_proc_proname_narg_type_index" - #define ProcedureSrcIndex "pg_proc_prosrc_index" #define TypeOidIndex "pg_type_oid_index" #define TypeNameIndex "pg_type_typname_index" #define ClassOidIndex "pg_class_oid_index" --- 38,43 ---- *************** *** 82,88 **** extern HeapTuple ProcedureOidIndexScan(Relation heapRelation, Oid procId); extern HeapTuple ProcedureNameIndexScan(Relation heapRelation, char *procName, int2 nargs, Oid *argTypes); - extern HeapTuple ProcedureSrcIndexScan(Relation heapRelation, text *procSrc); extern HeapTuple TypeOidIndexScan(Relation heapRelation, Oid typeId); extern HeapTuple TypeNameIndexScan(Relation heapRelation, char *typeName); extern HeapTuple ClassNameIndexScan(Relation heapRelation, char *relName); --- 81,86 ---- *************** *** 102,108 **** DECLARE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops)); DECLARE_INDEX(pg_proc_proname_narg_type_index on pg_proc using btree(proname name_ops, pronargs int2_ops, proargtypes oid8_ops)); - DECLARE_INDEX(pg_proc_prosrc_index on pg_proc using btree(prosrc text_ops)); DECLARE_INDEX(pg_type_oid_index on pg_type using btree(oid oid_ops)); DECLARE_INDEX(pg_type_typname_index on pg_type using btree(typname name_ops)); --- 100,105 ---- *** postgresql-6.5.3/src/include/utils/syscache.h.orig Sun Feb 14 08:22:32 1999 --- postgresql-6.5.3/src/include/utils/syscache.h Mon May 27 16:19:05 2002 *************** *** 59,67 **** #define GRONAME 23 #define GROSYSID 24 #define REWRITENAME 25 ! #define PROSRC 26 ! #define CLADEFTYPE 27 ! #define LANOID 28 /* ---------------- * struct cachedesc: information needed for a call to InitSysCache() --- 59,66 ---- #define GRONAME 23 #define GROSYSID 24 #define REWRITENAME 25 ! #define CLADEFTYPE 26 ! #define LANOID 27 /* ---------------- * struct cachedesc: information needed for a call to InitSysCache() *** postgresql-6.5.3/src/interfaces/ecpg/lib/ecpglib.c.orig Thu Jul 8 12:32:57 1999 --- postgresql-6.5.3/src/interfaces/ecpg/lib/ecpglib.c Mon May 27 16:19:05 2002 *************** *** 228,235 **** --- 228,238 ---- switch (arg[i]) { case '\'': + res[ri++] = '\''; + break; case '\\': res[ri++] = '\\'; + break; default: ; } *************** *** 365,371 **** bool string = false; for (; *ptr != '\0' && (*ptr != '?' || string); ptr++) ! if (*ptr == '\'') string = string ? false : true; return (*ptr == '\0') ? NULL : ptr; --- 368,374 ---- bool string = false; for (; *ptr != '\0' && (*ptr != '?' || string); ptr++) ! if (*ptr == '\'' && *(ptr-1) != '\\') string = string ? false : true; return (*ptr == '\0') ? NULL : ptr; *************** *** 379,384 **** --- 382,388 ---- PGresult *results; PGnotify *notify; struct variable *var; + int hostvarl = 0; memcpy((char *) &sqlca, (char *) &sqlca_init, sizeof(sqlca)); *************** *** 569,575 **** return false; strcpy(newcopy, copiedquery); ! if ((p = next_insert(newcopy)) == NULL) { /* --- 573,579 ---- return false; strcpy(newcopy, copiedquery); ! if ((p = next_insert(newcopy+hostvarl)) == NULL) { /* *************** *** 582,587 **** --- 586,592 ---- else { strcpy(p, tobeinserted); + hostvarl = strlen(newcopy); /* * The strange thing in the second argument is the rest of the *************** *** 1227,1232 **** --- 1232,1238 ---- { struct connection *con; + memcpy((char *) &sqlca, (char *) &sqlca_init, sizeof(sqlca)); if (strcmp(connection_name, "ALL") == 0) { for (con = all_connections; con;)