From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] More psql and libpq patches
Well..these would be the last patches until the release (I hope)...
I ran the regression tests while watching psql under purify, and it did
not leak even one byte.
In this patch:
* Plugged a major leak when PSQL reads files for input (either through
\i options or through -f option)
* Fixed the one remaining leak in PSQL in not clearing PGresult *results
everywhere it is supposed to. (Thanks Tymm)
* Fixed A small leak in PSQL not clearing all the PGsettings correctly.
* A not-so-obvious (but small) leak in Libpq when PQsetdb fails for any
reason.
* Added \n to some Libpq error messages to make them easier to digest..
* Finally, added /* PURIFY */ comment to some of the code indicating
the reason for why it was added/changed...for future developers.
I sent these changes in with a bunch of others. Some were folded in but
others, like these, were not. I am not sure why so I am resending this
to the developers list by itself for discussion.
The readon why I suggest these changes is that the compiler can't tell
that minimum_count is initialized before it is used. The tests that I
add in here will cause an immediate error if it doesn't. As the comments
below suggest, if it is 100% guaranteed that the variable will always
be initialized then how this is so should be commented here. I don't
know how much strain the actual test puts on the performance but if it
isn't too much then maybe leave it in for absolute safety anyway.
There are also a few returns just to stop warnings.
allpaths.c:find_join_paths(): compute_rel_size() shouldn't be called
for join-relations. Sizes already computed by
prune_rel_paths():compute_joinrel_size().
joinrels.c:
< if ( _use_right_sided_plans_ )
---
> if ( _use_right_sided_plans_ &&
> length (outer_rel->relids) > 1 )
- r_plans are useful when outer_rel is join-relation... It
decreases the size of search space...
New func RelationForgetRelation();
* RelationFlushRelation + if the relation is local then get rid of
* the relation descriptor from the newly created relation list.
Add upgradepath(), isoldpath(), upgradepoly() and revertpoly() to allow
migration from pre-v6.1 geometric data types.
Only allow new input syntax for paths and polygons.
cc1: warnings being treated as errors
dt.c: In function `timespan2tm':
dt.c:1722: warning: unused variable `funit'
dt.c:1722: warning: unused variable `iunit'
cc1: warnings being treated as errors
psql.c: In function `HandleSlashCmds':
psql.c:1141: warning: `optarg3' might be used uninitialized in this function
psql.c:1157: warning: `optarg3' might be used uninitialized in this function
From: David Friend <dfriend@atlsci.atlsci.com>
Subject: [PATCHES] INSTALL patch
This patch makes the following changes to the INSTALL instructions:
- Before step 1, describe disk space requirements.
- Step 1 now defines a "tested" platform.
- Add step 3a on checking for disk space.
- Added new step 27 asking for feedback.
From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] Another destroydb patch
This is a patch to my previous destroydb patch cause some people wanted
slightly different behavior. After this patch is applied, destroydb
will destroy a database as usual, but if added -i flag (which could be
aliased like rm -i) would ask for confirmation.
From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] pg_dump memory leak patch
This patch fixes a HUGE memory leak problem in pg_dump.
Pretty much anything that was allocated was never freed and Purify
reported about 40% possible memory leak and 6% actual leak. I added
functions to clear out all the allocated structures. After the patch
Purify returns 0 for number of bytes leaked...
From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] destroydb patch
I am including a patch for destroydb to ask for confirmation before
deleting databases (after I accidentally deleted mine)...destroydb -y
would force delete without any confirmation.
From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] memory leak patches in libpq and psql
A couple of small memory leak patches (detected with Purify) primarily
in libpq.
* Fixed (NULL) border problem in psql (run psql, do \m, then select
something from a table...row separators will be nulls)
* Fixed memory leak with the abovementioned border not being freed
properly.
* Fixed memory leak in freePGconn() not freeing conn->port
* Fixed up PQclear() to free parts of PGresult only if these
parts are not null.
* Fixed a decent memory leak that occured after executing every command
in psql. PGresult *results was not freed most of the time.
There is still a leak being detected (2 bytes) in readline functions, but
I think this is old readline library. I will install new one and test it.
Marc G. Fournier [Mon, 26 May 1997 00:43:41 +0000 (00:43 +0000)]
From: David Friend <dfriend@atlsci.atlsci.com>
Subject: [PATCHES] INSTALL changes
This patch modifies the INSTALL file. The changes are:
- SPARC/Linux-ELF was added to the list of supported platforms.
The special notes for it at the bottom of the file were removed.
- Changed "database server" to "RDBMS database server".
- Modified step 6 so that when you restore your database the
tables will be owned by the original owners instead of the
postgresql superuser.
- Modified step 19 on diagnosing the regression tests for the
SPARC Linux platform with a beta release.
- Other minor changes.
Enable new date and time definitions to allow Solaris and Irix -O2 compilation.
Move date and time field type labels to less than 32 to allow use as masks.
Vadim B. Mikheev [Thu, 22 May 1997 17:24:20 +0000 (17:24 +0000)]
RelationPurgeLocalRelation():
/*
* RelationFlushRelation () below will flush relation information
* from the cache. We must call smgrclose to flush relation
* information from SMGR & FMGR, too. We assume that for temp
* relations smgrunlink is already called by heap_destroyr
* and we skip smgrclose for them. - vadim 05/22/97
*/
smgrclose(reln->rd_rel->relsmgr, reln);
- it avoids memory leaks in SMGR & VFD.
RelationFlushRelation():
there is no more call FileInvalidate(RelationGetSystemPort(relation));
- invalid (FileInvalidate() expects File, not SMGR' fd)
- unuseful anyway.
Vadim B. Mikheev [Thu, 22 May 1997 17:08:35 +0000 (17:08 +0000)]
1. Fix md memory leak:
mdunlink() and mdclose() (too !!!) now free MdfdVec for relation
and add it to free list, so it may be re-used for another relation
later.
2. Fix VFD-manager memory leak (found by Massimo ... and me):
mdunlink() has to call FileUnlink() to free allocation for fileName
and add the Vfd slot to the free list.
Vadim B. Mikheev [Thu, 22 May 1997 16:09:57 +0000 (16:09 +0000)]
gist.h:
/*
** You can have as many strategies as you please in GiSTs, as
** long as your consistent method can handle them
*/
#define GISTNStrategies 100
^^^
- too big number:
strat.h->StrategyEvaluationData->StrategyExpression expression[12]
^^
- so 12 is real max # of strategies, or StrategyEvaluationIsValid
crashes backend (called if CASSER defined).