Neil Conway [Fri, 11 Feb 2005 04:09:05 +0000 (04:09 +0000)]
Adjust input routines for float4, float8 and oid to reject the empty string
as valid input (it was previously treated as 0). This input was deprecated
in 8.0 (and a warning was emitted). Regression tests updated.
Tom Lane [Thu, 10 Feb 2005 20:36:28 +0000 (20:36 +0000)]
Fix SPI cursor support to allow scanning the results of utility commands
that return tuples (such as EXPLAIN). Per gripe from Michael Fuhr.
Side effect: fix an old bug that unintentionally disabled backward scans
for all SPI-created cursors.
Neil Conway [Wed, 9 Feb 2005 23:17:26 +0000 (23:17 +0000)]
ALTER TABLE ADD COLUMN exhibits a significant memory leak when adding a
column with a default expression. In that situation, we need to rewrite
the heap relation. To evaluate the new default expression, we use
ExecEvalExpr(); however, this can allocate memory in the current memory
context, and ATRewriteTable() does not switch out of the active portal's
heap memory context. The end result is a rather large memory leak (on
the order of gigabytes for a reasonably sized table).
This patch changes ATRewriteTable() to switch to the per-tuple memory
context before beginning the per-tuple loop. It also removes an explicit
heap_freetuple() in the loop, since that is no longer needed.
In an unrelated change, I noticed the code was scanning through the
attributes of the new tuple descriptor for each tuple of the old table.
I changed this to use precomputation, which should slightly speed up
the loop.
Bruce Momjian [Tue, 8 Feb 2005 03:21:02 +0000 (03:21 +0000)]
It seems like most people don't want automatic failover so I am removing
the item:
< o Automatic failover
<
< The proper solution to this will probably the use of a master/slave
< replication solution like Sloney and a connection pooling tool like
< pgpool.
<
Tom Lane [Sun, 6 Feb 2005 20:19:08 +0000 (20:19 +0000)]
Repair CLUSTER failure after ALTER TABLE SET WITHOUT OIDS. Turns out
there are corner cases involving dropping toasted columns in which the
previous coding would fail, too: the new version of the table might not
have any TOAST table, but we'd still propagate possibly-wide values of
dropped columns forward.
Tom Lane [Sat, 5 Feb 2005 19:38:58 +0000 (19:38 +0000)]
Marginal hack to merge adjacent ReleaseBuffer/ReadBuffer calls into
ReleaseAndReadBuffer during GIST index searches. We already did this
in btree and rtree, might as well do it here too.
Tom Lane [Thu, 3 Feb 2005 23:38:58 +0000 (23:38 +0000)]
Fix minor thinko in logic to set dump order when dumping from a pre-7.3
database: aggregates should be dumped in the same pass as operators,
not in the same pass as functions.
Tom Lane [Thu, 3 Feb 2005 23:29:19 +0000 (23:29 +0000)]
Ensure that all details of the ARC algorithm are hidden within freelist.c.
This refactoring does not change any algorithms or data structures, just
remove visibility of the ARC datastructures from other source files.
Tom Lane [Wed, 2 Feb 2005 21:49:09 +0000 (21:49 +0000)]
Adjust constant-folding of CASE expressions so that the simple comparison
form of CASE (eg, CASE 0 WHEN 1 THEN ...) can be constant-folded as it
was in 7.4. Also, avoid constant-folding result expressions that are
certainly unreachable --- the former coding was a bit cavalier about this
and could generate unexpected results for all-constant CASE expressions.
Add regression test cases. Per report from Vlad Marchenko.
Bruce Momjian [Wed, 2 Feb 2005 17:26:49 +0000 (17:26 +0000)]
Update RESET ALL items:
< all temporary tables, removal of any NOTIFYs, etc. This could be used
< for connection pooling. We could also change RESET ALL to have this
< functionality.
> all temporary tables, removal of any NOTIFYs, cursors, prepared
> queries(?), currval()s, etc. This could be used for connection pooling.
> We could also change RESET ALL to have this functionality.
Neil Conway [Wed, 2 Feb 2005 06:36:02 +0000 (06:36 +0000)]
Add support for temporary views, including documentation and regression
tests. Contributed by Koju Iijima, review from Neil Conway, Gavin Sherry
and Tom Lane.
Also, fix error in description of WITH CHECK OPTION clause in the CREATE
VIEW reference page: it should be "CASCADED", not "CASCADE".
Tom Lane [Tue, 1 Feb 2005 23:08:13 +0000 (23:08 +0000)]
Adjust estimate_num_groups() to not clamp per-relation group count
estimate to less than the number of values estimated for any one grouping
Var, as suggested by Manfred. This is intuitively right, and what's
more it puts the plan choices in the subselect regression test back the
way they were before ...
Tom Lane [Tue, 1 Feb 2005 19:35:14 +0000 (19:35 +0000)]
Adjust plpgsql to allow assignment to an element of an array that is
initially NULL. For 8.0 we changed the main executor to have this
behavior in an UPDATE of an array column, but plpgsql's equivalent case
was overlooked. Per report from Sven Willenberger.
Tom Lane [Tue, 1 Feb 2005 00:59:09 +0000 (00:59 +0000)]
Sync inet formatting code with recent BIND releases. In particular,
fix bug with inconsistent selection of default mask length for
"class D" addresses. Per report from Steve Atkins.
Tom Lane [Fri, 28 Jan 2005 20:34:27 +0000 (20:34 +0000)]
When dealing with multiple grouping columns coming from the same table,
clamp the estimated number of groups to table row count over 10, instead
of table row count; this reflects a heuristic that people probably won't
group over a near-unique set of columns, and the knowledge that we don't
currently have any way to estimate the correlation of the columns better
than guessing. This change creates a trivial plan change in one of the
regression tests.
Tom Lane [Fri, 28 Jan 2005 19:34:28 +0000 (19:34 +0000)]
Improve planner's estimation of the space needed for HashAgg plans:
look at the actual aggregate transition datatypes and the actual overhead
needed by nodeAgg.c, instead of using pessimistic round numbers.
Per a discussion with Michael Tiemann.
Tom Lane [Fri, 28 Jan 2005 00:34:32 +0000 (00:34 +0000)]
Adjust mkdir_p to do stat() before trying mkdir(). Avoids problems on
Solaris and should be a little faster anyway, since in most scenarios
all but perhaps the last path component will already exist.
Neil Conway [Thu, 27 Jan 2005 23:36:15 +0000 (23:36 +0000)]
Small patch to move get_grosysid() from catalog/aclchk.c to
utils/cache/lsyscache.c where it can be used by other things. Also
cleans up both get_usesysid() and get_grosysid() a bit. From Stephen
Frost.
Neil Conway [Thu, 27 Jan 2005 06:36:42 +0000 (06:36 +0000)]
Provide a more descriptive error message when the return type of an SRF
does not match what the query expected. From Brendan Jurd, minor
editorializing by Neil Conway.
Tom Lane [Thu, 27 Jan 2005 03:19:37 +0000 (03:19 +0000)]
Generalize TRUNCATE to support truncating multiple tables in one
command. This is useful because we can allow truncation of tables
referenced by foreign keys, so long as the referencing table is
truncated in the same command.
Tom Lane [Wed, 26 Jan 2005 23:20:21 +0000 (23:20 +0000)]
Close all cursors created during a failed subtransaction. This is needed
to avoid problems when a cursor depends on objects created or changed in
the same subtransaction. We'd like to do better someday, but this seems
the only workable answer for 8.0.1.
Tom Lane [Wed, 26 Jan 2005 21:24:12 +0000 (21:24 +0000)]
Minor tweak to avoid unnecessary memory bloat when dumping extremely wide
column values in -d mode. Per report from Marty Scholes. This doesn't
completely solve the issue, because we still need multiple copies of the
field value, but at least one copy can be got rid of painlessly ...