Tom Lane [Fri, 4 Feb 2000 03:16:03 +0000 (03:16 +0000)]
Squash longstanding memory leak: when catcache.c copied a tuple into
the cache context, it didn't bother to free the tuple that
CatalogIndexFetchTuple had allocated in the transaction context.
Do enough cache lookups in the same xact, and you start to notice...
Tom Lane [Thu, 3 Feb 2000 06:12:19 +0000 (06:12 +0000)]
Make EXPLAIN results for Append, Group, Agg, Unique nodes more plausible.
Group and Unique use an arbitrary assumption that there will be about
10% as many groups as input tuples --- perhaps someday we can refine this.
Tom Lane [Mon, 31 Jan 2000 04:35:57 +0000 (04:35 +0000)]
Fix problems seen in parallel regress tests when SI buffer overruns (causing
syscache and relcache flushes). Relcache entry rebuild now preserves
original tupledesc, rewrite rules, and triggers if possible, so that pointers
to these things remain valid --- if these things change while relcache entry
has positive refcount, we elog(ERROR) to avoid later crash. Arrange for
xact-local rels to be rebuilt when an SI inval message is seen for them,
so that they are updated by CommandCounterIncrement the same as regular rels.
(This is useful because of Hiroshi's recent changes to process our own SI
messages at CommandCounterIncrement time.) This allows simplification of
some routines that previously hacked around the lack of an automatic update.
catcache now keeps its own copy of tupledesc for its relation, rather than
depending on the relcache's copy; this avoids needing to reinitialize catcache
during a cache flush, which saves some cycles and eliminates nasty circularity
problems that occur if a cache flush happens while trying to initialize a
catcache.
Eliminate a number of permanent memory leaks that used to happen during
catcache or relcache flush; not least of which was that catcache never
freed any cached tuples! (Rule parsetree storage is still leaked, however;
will fix that separately.)
Nothing done yet about code that uses tuples retrieved by SearchSysCache
for longer than is safe.
Tom Lane [Sat, 29 Jan 2000 19:51:59 +0000 (19:51 +0000)]
Modify uses of RelationFlushRelation and RelationCacheInvalidate so that
we *always* rebuild, rather than deleting, an invalidated relcache entry
that has positive refcount. Otherwise an SI cache overrun leads to
dangling Relation pointers all over the place!
Peter Eisentraut [Sat, 29 Jan 2000 16:58:54 +0000 (16:58 +0000)]
A few minor psql enhancements
Initdb help correction
Changed end/abort to commit/rollback and changed related notices
Commented out way old printing functions in libpq
Fixed a typo in alter table / alter column
Tom Lane [Fri, 28 Jan 2000 03:22:36 +0000 (03:22 +0000)]
Apply the heuristic proposed by Taral (see pgsql-general archives for
2-Oct-98 or TODO.detail/cnfify) to decide whether we want to reduce
WHERE clause to CNF form, DNF form, or neither. This is a HUGE win.
The heuristic conditions could probably still use a little tweaking to
make sure we don't pick CNF when DNF would be better, or vice versa,
but the risk of exponential explosion in cnfify() is gone. I was able
to run ten-thousand-AND-subclause queries through the planner in a
reasonable amount of time.
Tom Lane [Thu, 27 Jan 2000 18:11:50 +0000 (18:11 +0000)]
Redesign DISTINCT ON as discussed in pgsql-sql 1/25/00: syntax is now
SELECT DISTINCT ON (expr [, expr ...]) targetlist ...
and there is a check to make sure that the user didn't specify an ORDER BY
that's incompatible with the DISTINCT operation.
Reimplement nodeUnique and nodeGroup to use the proper datatype-specific
equality function for each column being compared --- they used to do
bitwise comparisons or convert the data to text strings and strcmp().
(To add insult to injury, they'd look up the conversion functions once
for each tuple...) Parse/plan representation of DISTINCT is now a list
of SortClause nodes.
initdb forced by querytree change...
PostgreSQL to_char is very compatible with Oracle's to_char(), but not
total exactly (now). Small differentions are in number formating. It will
fix in next to_char() version.
! If will this patch aplly to the main tree, must be delete the current
to_char version in contrib (directory "dateformat" and note in contrib's
README), this patch not erase it (sorry Bruce).
The patch patching files:
doc/src/sgml/func.sgml
^^^^^^^^
Hmm, I'm not sure if my English... :( Check it anyone (volunteer)?
Thomas, it is right? SGML is not my primary lang and compile
the current PG docs tree is very happy job (hard variables setting in
docs/sgml/Makefile --> HSTYLE= /home/users/t/thomas/.... :-)
What add any definition to global configure.in and set Makefiles in docs
tree via ./configure?
src/backend/utils/adt/Makefile
src/backend/utils/adt/formatting.c
src/include/catalog/pg_proc.h
src/include/utils/formatting.h
Karel Zak <zakkr@zf.jcu.cz> http://home.zf.jcu.cz/~zakkr/
Tom Lane [Tue, 25 Jan 2000 01:59:27 +0000 (01:59 +0000)]
Forgot that expr assumes regexp is anchored-left; therefore need .*
in front of any platform name pattern that's not supposed to match
beginning at the start of the machine type name...
Peter Eisentraut [Mon, 24 Jan 2000 19:34:19 +0000 (19:34 +0000)]
Made abstime/reltime use int4 instead of time_t (TODO item)
Made type equivalency apply to aggregates (TODO item)
Fixed parsing bug in psql
Reverted some stupid options changes I made to pg_dump
Tom Lane [Mon, 24 Jan 2000 07:16:52 +0000 (07:16 +0000)]
First cut at making useful selectivity estimates for range queries
(ie, WHERE x > lowbound AND x < highbound). It's not very bright yet
but it does something useful. Also, rename intltsel/intgtsel to
scalarltsel/scalargtsel to reflect usage better. Extend convert_to_scalar
to do something a little bit useful with string data types. Still need
to make it do something with date/time datatypes, but I'll wait for
Thomas's datetime unification dust to settle first. Eventually the
routine ought not have any type-specific knowledge at all; it ought to
be calling a type-dependent routine found via a pg_type column; but
that's a task for another day.
Tom Lane [Sun, 23 Jan 2000 03:43:24 +0000 (03:43 +0000)]
Replace SearchSysCacheGetAttribute with SysCacheGetAttr, which fetches
an attribute of a tuple previously fetched with SearchSysCacheTuple.
This avoids a lot of redundant cache lookups, particularly in selfuncs.c.
Also, remove SearchSysCacheStruct, which was unused and grotty.
Peter Eisentraut [Sun, 23 Jan 2000 01:27:39 +0000 (01:27 +0000)]
updated install file
updated date/time types doc
fixed small psql bug
removed libpq code that lower-cased db names
make notice when long identifier is truncated
Tom Lane [Sat, 22 Jan 2000 23:50:30 +0000 (23:50 +0000)]
Revise handling of index-type-specific indexscan cost estimation, per
pghackers discussion of 5-Jan-2000. The amopselect and amopnpages
estimators are gone, and in their place is a per-AM amcostestimate
procedure (linked to from pg_am, not pg_amop).
Tom Lane [Fri, 21 Jan 2000 23:32:36 +0000 (23:32 +0000)]
Fix tab-complete so it works with old versions of readline that don't
have the rl_completion_append_character variable. The tab completion
behavior doesn't seem to be quite perfect in that situation, but it's
better than failing to build at all...
Tom Lane [Fri, 21 Jan 2000 04:21:12 +0000 (04:21 +0000)]
Fix handleCopyIn's response to EOF seen mid-line, that is, input file
does not end with a newline. I don't think this explains the recent
complaints, since this bug existed in 6.5 (and probably long before).
But might as well fix it now that I see it.
Bruce Momjian [Thu, 20 Jan 2000 15:21:23 +0000 (15:21 +0000)]
I have noticed that the geometry test's output for hppa1 and hppa2 are in
fact the same, so I suggest they could be the same file say
geometry-positive-zeros.out, as the main difference seems to be not printing
eg. (0,-0). In src/test/regress/expected, I propose
and the following patch to resultmap. I have only tested the netbsd results
on i386, but think that in all probability the differences will be the same
for other ports. If it turns out not to be the case, at least we might find
out.
Bruce Momjian [Thu, 20 Jan 2000 15:13:19 +0000 (15:13 +0000)]
Bruce,
Attached is a small fix for a stupid mistake I made in comment.c
- an attempt to drop a non-existent comment would dump core :-(.
Sometimes, I'm as sharp as a marble.
Tom Lane [Thu, 20 Jan 2000 05:23:26 +0000 (05:23 +0000)]
ecpg shouldn't depend on parser/gramparse.h. Also, eliminate some
compiler warnings caused by lack of extern declarations in extern.h.
I believe the remaining gcc warnings here would go away if the ecpg
grammar could be tweaked so it doesn't use REJECT ...
Tom Lane [Thu, 20 Jan 2000 02:24:50 +0000 (02:24 +0000)]
Assign a typmod of -1 to unadorned CHAR and NUMERIC type specs. This
allows casts without specific length requirements to continue to work
as they did before; that is, x::char will not truncate the value of x,
whereas x::char(1) will. Likewise for NUMERIC precision/scale.
The column length defaults of char(1) and numeric(30,6) are now inserted
in analyze.c's processing of CREATE TABLE.
Tom Lane [Thu, 20 Jan 2000 02:21:44 +0000 (02:21 +0000)]
Fix bugs in NUMERIC ceil() and floor() functions. ceil(0) returned 1,
and both would insert random junk digits if given an input that was an
exact multiple of 10.
Tom Lane [Wed, 19 Jan 2000 23:55:03 +0000 (23:55 +0000)]
Fix handling of NULL constraint conditions: per SQL92 spec, a NULL result
from a constraint condition does not violate the constraint (cf. discussion
on pghackers 12/9/99). Implemented by adding a parameter to ExecQual,
specifying whether to return TRUE or FALSE when the qual result is
really NULL in three-valued boolean logic. Currently, ExecRelCheck is
the only caller that asks for TRUE, but if we find any other places that
have the wrong response to NULL, it'll be easy to fix them.