Commit Graph

14056 Commits

Author SHA1 Message Date
Tom Lane
5869e883ee WAL must log CREATE and DROP DATABASE operations *without* using any
explicit paths, so that the log can be replayed in a data directory
with a different absolute path than the original had.  To avoid forcing
initdb in the 8.0 branch, continue to accept the old WAL log record
types; they will never again be generated however, and the code can be
dropped after the next forced initdb.  Per report from Oleg Bartunov.
We still need to think about what it really means to WAL-log CREATE
TABLESPACE commands: we more or less have to put the absolute path
into those, but how to replay in a different context??
2005-03-23 00:04:25 +00:00
Tom Lane
1cef5beeea Fix quote_ident to use quote_identifier rather than its own, not quite
up-to-speed logic; in particular this will cause it to quote names that
match keywords.  Remove unnecessary multibyte cruft from quote_literal
(all backend-internal encodings are 8-bit-safe).
2005-03-21 16:29:31 +00:00
Tom Lane
8ae13aac52 Put 'dump complete' message in the right place, so it comes out where
it's supposed to when --file option is used.
2005-03-18 17:33:03 +00:00
Tom Lane
817bc021b7 Need to reset local buffer pin counts, not only shared buffer pins,
before we attempt any file deletions in ShutdownPostgres.  Per Tatsuo.
2005-03-18 16:16:20 +00:00
Michael Meskes
fc80f5fe73 Added patch by Christof Petig <christof@petig-baender.de> to work around gcc bug on powerpc and amd64. 2005-03-18 10:01:14 +00:00
Tom Lane
b03072571e Need to release buffer pins before attempting to drop files during
backend exit.  Per report from Bruce.
2005-03-18 05:24:24 +00:00
Tom Lane
bcfe5088e5 Treat EPERM as a non-error case when checking to see if old postmaster
is still alive.  This improves our odds of not getting fooled by an
unrelated process when checking a stale lock file.  Other checks already
in place, plus one newly added in checkDataDir(), ensure that we cannot
attempt to usurp the place of a postmaster belonging to a different userid,
so there is no need to error out.  Add comments indicating the importance
of these other checks.
2005-03-18 03:49:19 +00:00
Bruce Momjian
7911e3a081 Backpatch to 8.0.X, already in HEAD:
Allow Win32 to support the O_SYNC open flag as an wal_sync_method
method.
2005-03-17 17:28:59 +00:00
Bruce Momjian
89ea098714 Add missing include for new lc_ctype_is_c() function.
Per Neil.
2005-03-16 01:49:20 +00:00
Bruce Momjian
fb2c2d83e0 Prevent locale-aware handling of upper, lower, and initcap when the
locale is C.

Backpatch to 8.0.X because some operating systems were throwing errors
for such operations, rather than ignoring the locale when it was C.
2005-03-16 00:03:02 +00:00
Bruce Momjian
f38cb720d9 Increment all major version numbers in 8.0.X to force recompile of
client aplications so 7.4.X releases can be installed on the same
machine as 8.0.X.
2005-03-13 22:04:45 +00:00
Tom Lane
b3dbaab1e9 Fix ALTER DATABASE RENAME to allow the operation if user is a superuser
who for some reason isn't marked usecreatedb.  Per report from Alexander
Pravking.  Also fix sloppy coding in have_createdb_privilege().
2005-03-12 21:12:05 +00:00
Tom Lane
bdcf632d62 Fix problem with infinite recursion between write_syslogger_file and
elog if the former has trouble writing its file.  Code review for
Magnus' patch to redirect stderr to syslog on Windows (Bruce's version
seems right, but did some minor prettification).

Backpatch both changes to 8.0 branch.
2005-03-12 01:55:15 +00:00
Bruce Momjian
30854a53fe Properly implement "Response files" for bcc. Add URL's to describe the
feature for Win32 and bcc.
2005-03-07 21:11:07 +00:00
Tom Lane
4e8af8d273 Replace ARC cache management algorithm with the similar but slightly
simpler 2Q algorithm, to avoid possible problems with the pending patent
on ARC.  Testing so far suggests that there is little if any performance
loss from doing this.

Note that this patch is going into the 8.0 branch only; a much more
extensive revision is planned for HEAD.
2005-03-03 16:47:43 +00:00
Tom Lane
3f16b38a23 Release proclock immediately in RemoveFromWaitQueue() if it represents
no held locks.  This maintains the invariant that proclocks are present
only for procs that are holding or awaiting a lock; when this is not
true, LockRelease will fail.  Per report from Stephen Clouse.
2005-03-01 21:15:10 +00:00
Tom Lane
bfc2942321 Adjust OR indexscan logic to not generate redundant condition-free OR
indexscans involving partial indexes.  These would always be dominated
by a simple indexscan on such an index, so there's no point in considering
them.  Fixes overoptimism in a patch I applied last October.
2005-03-01 01:40:39 +00:00
Tom Lane
3da9fd8544 Revert the logic for expanding AND/OR conditions in pred_test() to what
it was in 7.4, and add some comments explaining why it has to be this way.
I broke it for OR'd index predicates in a fit of code cleanup last summer.
Per example from Sergey Koshcheyev.
2005-03-01 00:25:45 +00:00
Bruce Momjian
ba6b067ce8 Tab indent all actions in bcc32.mak, and do it on win32.mak too for
consistency.  Backpatch only bcc32.mak to 8.0.X.
2005-02-27 22:38:29 +00:00
Bruce Momjian
a72fd004ba Add linking from /port to bcc makefile. 2005-02-25 15:57:41 +00:00
Bruce Momjian
bb7f5a7393 Try to get Borland CC to compile.
Backpatch to 8.0.X which doesn't work right now.
2005-02-21 21:22:46 +00:00
Tom Lane
0845ee3958 New arrangement to always let the bgwriter do checkpoints broke
CHECKPOINT and some other commands in the context of a standalone
backend.  Allow a standalone backend to do its own checkpoints.
2005-02-19 23:16:27 +00:00
Tom Lane
254eef2f28 Ensure that the resolved datatype of any unknown Param is propagated
into the sub-SELECT targetlist when it appears in the context
INSERT INTO foo SELECT $1 ...  Per report from Abhijit Menon-Sen.
2005-02-19 19:33:23 +00:00
Tom Lane
c35c944b87 ALTER LANGUAGE RENAME has never worked. Per Sergey Yatskevich. 2005-02-14 06:17:59 +00:00
Bruce Momjian
92597d1386 Print file name and errno string on rmtree failure.
Backpatch to 8.0.X.
2005-02-13 16:50:54 +00:00
Peter Eisentraut
66b568ca96 Translation updates 2005-02-11 11:53:32 +00:00
Tom Lane
9843862b50 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.
2005-02-10 20:36:49 +00:00
Michael Meskes
95b40b7f77 Fixed more parsing bugs in other CREATE statements. 2005-02-10 08:07:46 +00:00
Neil Conway
789aafebd5 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.

Thanks to steve@deefs.net for reporting the leak.
2005-02-09 23:27:24 +00:00
Michael Meskes
ef006ded8e Fixed bug in parsing of CREATE AS statement. 2005-02-09 11:28:21 +00:00
Tom Lane
ae50aa7ee8 If we're gonna check for array overrun, we really should do so before
overrunning the array, not after.
2005-02-08 18:21:59 +00:00
Neil Conway
6c5c748d64 Prevent 4 more buffer overruns in the PL/PgSQL parser. This is just a
minimally-invasive fix for stable branches; a cleaner fix will be
committed to HEAD soon.
2005-02-07 03:52:22 +00:00
Tom Lane
0aeb7d8008 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.
2005-02-06 20:19:24 +00:00
Tom Lane
a7bbb6cd53 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.
2005-02-03 23:39:21 +00:00
Tom Lane
c8460d571e 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.
2005-02-03 23:30:12 +00:00
Tom Lane
f76390d75a Improve performance of fmgr.c calling routines for cases with more than
two arguments.  Per suggestions from A. Ogawa.
2005-02-02 22:40:19 +00:00
Tom Lane
388a42c515 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.
2005-02-02 21:49:49 +00:00
Neil Conway
a8daceaa15 Fix a bug induced by the list-rewrite that resulted in incrementing the
command counter more than necessary. Per report from Michael Fuhr.
2005-02-01 23:29:13 +00:00
Tom Lane
914db10289 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 ...
2005-02-01 23:09:00 +00:00
Tom Lane
86206573ed 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.
2005-02-01 19:35:29 +00:00
Tom Lane
b46fa4ba81 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.
2005-02-01 00:59:53 +00:00
Tom Lane
8097ce9f52 Stamp 8.0 branch as 8.0.1. 2005-01-30 19:17:49 +00:00
Peter Eisentraut
372d78997c Translation updates 2005-01-30 15:47:30 +00:00
Tom Lane
7c67dcacd8 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.
2005-01-28 20:35:14 +00:00
Tom Lane
a098f533d1 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.
2005-01-28 19:36:33 +00:00
Tom Lane
af5cd5ba92 pg_aggregate.h fails to compile standalone, for lack of an #include
defining List.
2005-01-28 17:36:04 +00:00
Tom Lane
51aac36996 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.
2005-01-28 00:36:17 +00:00
Tom Lane
f2196c00b2 Check that aggregate creator has the right to execute the transition
functions of the aggregate, at both aggregate creation and execution times.
2005-01-27 23:42:44 +00:00
Peter Eisentraut
094326cbd8 Backpatch translations 2005-01-27 12:10:04 +00:00
Tom Lane
aa060cd714 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.
2005-01-26 23:20:37 +00:00