Tom Lane [Thu, 22 Sep 2005 23:25:07 +0000 (23:25 +0000)]
Fix bug introduced into indexable_outerrelids() by an ill-considered
"optimization". When we find a potentially useful joinclause, we
have to add all its other required_relids to the result, not only the
other clause_relids. They are different in the case of a joinclause
whose applicability has to be postponed due to outer join. We have
to include the extra rels because otherwise, after best_inner_indexscan
masks the join rels with index_outer_relids, it will always fail to
find the joinclause as applicable. Per report from Husam Tomeh.
Tom Lane [Thu, 22 Sep 2005 17:32:58 +0000 (17:32 +0000)]
Take exclusive buffer lock in scan_heap() to eliminate some corner cases
in which invalid page data could be transiently written to disk by
concurrent bgwriter activity. There doesn't seem any risk of loss of
actual user data, but an empty page could possibly be left corrupt if a
crash occurs before the correct data gets written out. Pointed out by
Alvaro Herrera.
Tom Lane [Wed, 21 Sep 2005 20:33:34 +0000 (20:33 +0000)]
Fix postgresql.conf lexer to accept doubled single quotes in literal
strings. This is consistent with SQL conventions, and since Bruce
already changed initdb in a way that assumed it worked like this, seems
we'd better make it work like this.
Bruce Momjian [Tue, 20 Sep 2005 20:51:30 +0000 (20:51 +0000)]
Merge items:
< This would be beneficial when there are few distinct values.
> This would be beneficial when there are few distinct values. This is
> already used by GROUP BY. 946d946
< * Allow DISTINCT to use hashing like GROUP BY
Bruce Momjian [Fri, 16 Sep 2005 16:46:09 +0000 (16:46 +0000)]
Update wording:
< 390d388
< 453c451
< removed or have its heap and index files truncated. One
> be removed or have its heap and index files truncated. One
< * Use a phantom command counter for nested subtransactions to reduce
< per-tuple overhead
Neil Conway [Fri, 16 Sep 2005 05:35:41 +0000 (05:35 +0000)]
Rename pg_complete_relation_size() to pg_total_relation_size(), for the
sake of brevity and clarity.
Make pg_reload_conf(), pg_rotate_logfile(), and pg_cancel_backend()
return a boolean rather than an integer to indicate success or failure.
Along the way, make some minor cleanups to dbsize.c -- in particular,
use elog() rather than ereport() for "shouldn't happen" error
conditions, and remove some of the more flagrant violations of the
Postgres indentation conventions.
Tom Lane [Fri, 16 Sep 2005 00:30:05 +0000 (00:30 +0000)]
Force the size and alignment of LWLock array entries to be either 16 or 32
bytes. This shouldn't make any difference on x86 machines, where the size
happened to be 16 bytes anyway, but on 64-bit machines and machines with
slock_t int or wider, it will speed array indexing and hopefully reduce
SMP cache contention effects. Per recent experimentation.
Neil Conway [Wed, 14 Sep 2005 21:14:26 +0000 (21:14 +0000)]
Various documentation improvements. Add a lot of index entries for
the builtin functions (although some more entries are still needed),
and remove the duplicate index entries that have been causing
collateindex.pl warnings. Consistently use "int" and "bigint", rather
than a mix of "int", "integer", "int4", "bigint", and "int8". Make
parenthesis style in syntax examples more consistent. Various
copy-editing for newly-added documentation and SGML markup fixes.
Tom Lane [Mon, 12 Sep 2005 22:20:16 +0000 (22:20 +0000)]
Ensure that any memory leaked during an error inside the bgwriter is
recovered. I did not see any actual leak while testing this in CVS tip,
but 8.0 definitely has a problem with leaking the space temporarily
palloc'd by BufferSync(). In any case this seems a good idea to forestall
similar problems in future. Per report from Arjen van der Meijden.
Neil Conway [Mon, 12 Sep 2005 22:11:38 +0000 (22:11 +0000)]
Make the documentation of GUC variables a separate chapter, rather than
a section of the "Server Run-time Environment" chapter. Also, move the
SGML for the new chapter to a separate file and fix the resulting
fallout.
Tom Lane [Mon, 12 Sep 2005 19:17:45 +0000 (19:17 +0000)]
Update manual's introduction to indexes to reflect 8.1 changes; in
particular the addition of bitmap scans and the relaxation of rules
about when multicolumn indexes can be used. Also some minor editorial
work in other parts of the chapter.
Tom Lane [Mon, 12 Sep 2005 02:26:33 +0000 (02:26 +0000)]
Tweak TCP-keepalive code so that an invalid setting doesn't cause us
to drop connections unceremoniously. Also some other marginal cleanups:
don't query getsockopt() repeatedly if it fails, and avoid having the
apparent definition of struct Port depend on which system headers you
might have included or not. Oliver Jowett and Tom Lane.
Neil Conway [Sun, 11 Sep 2005 23:40:33 +0000 (23:40 +0000)]
Many small improvements and copy edits to the release notes. Use "—"
rather than "-" for the "dash" character. Correct SGML markup. Make
references to the names of contributors more consistent. Rewrite a bit
of prose, and make some other similar cleanups.
Tom Lane [Sun, 11 Sep 2005 04:10:25 +0000 (04:10 +0000)]
Fix some corner-case bugs in _sendSQLLine's parsing of SQL commands
> found in a pg_dump archive. It had problems with dollar-quote tags
broken across bufferload boundaries (this may explain bug report from
Rod Taylor), also with dollar-quote literals of the form $a$a$...,
and was also confused about the rules for backslash in double quoted
identifiers (ie, they're not special). Also put in placeholder support
for E'...' literals --- this will need more work later.
Tom Lane [Sun, 11 Sep 2005 00:36:14 +0000 (00:36 +0000)]
Avoid changing stdin/stdout to binary mode on Windows unless that is
really the source or destination of the archive. I think this will
resolve recent complaints that password prompting is broken in pg_restore
on Windows. Note that password prompting and reading from stdin is an
unworkable combination on Windows ... but that was true anyway.
Tom Lane [Fri, 9 Sep 2005 06:51:12 +0000 (06:51 +0000)]
Given its current definition that depends on time(NULL), timetz_zone
is certainly no longer immutable, but must indeed be marked volatile.
I wonder if it should use the value of now() (that is, transaction
start time) so that it could be marked stable. But it's probably not
important enough to be worth changing the code for ... indeed, I'm not
even going to force an initdb for this catalog change, seeing that we
just did one a few hours ago.
Tom Lane [Fri, 9 Sep 2005 06:46:14 +0000 (06:46 +0000)]
timestamptz_izone should return the input, not NULL, when the input
is a non-finite timestamp, for consistency with related functions.
In other words: +infinity rotated to a different timezone is still
+infinity.
Tom Lane [Fri, 9 Sep 2005 02:31:50 +0000 (02:31 +0000)]
Fix the various forms of AT TIME ZONE to accept either timezones found
in the zic database or zone names found in the date token table. This
preserves the old ability to do AT TIME ZONE 'PST' along with the new
ability to do AT TIME ZONE 'PST8PDT'. Per gripe from Bricklen Anderson.
Also, fix some inconsistencies in usage of TZ_STRLEN_MAX --- the old
code had the potential for one-byte buffer overruns, though given
alignment considerations it's unlikely there was any real risk.
Tom Lane [Thu, 8 Sep 2005 20:07:42 +0000 (20:07 +0000)]
Create the pg_pltemplate system catalog to hold template information
for procedural languages. This replaces the hard-wired table I had
originally proposed as a stopgap solution. For the moment, the initial
contents only include languages shipped with the core distribution.
Tom Lane [Wed, 7 Sep 2005 21:39:25 +0000 (21:39 +0000)]
Update timezone data files to release 2005m of the zic database.
Among other changes, this reflects the recently passed change in USA
daylight savings rules.
Tom Lane [Mon, 5 Sep 2005 23:50:49 +0000 (23:50 +0000)]
Implement a preliminary 'template' facility for procedural languages,
as per my recent proposal. For now the template data is hard-wired in
proclang.c --- this should be replaced later by a new shared system
catalog, but we don't want to force initdb during 8.1 beta. This change
lets us cleanly load existing dump files even if they contain outright
wrong information about a PL's support functions, such as a wrong path
to the shared library or a missing validator function. Also, we can
revert the recent kluges to make pg_dump dump PL support functions that
are stored in pg_catalog.
While at it, I removed the code in pg_regress that replaced $libdir
with a hardcoded path for temporary installations. This is no longer
needed given our support for relocatable installations.
Tom Lane [Mon, 5 Sep 2005 18:59:38 +0000 (18:59 +0000)]
Back out prior patch and instead just suppress SubqueryScan elimination
when there are extra resjunk columns in the child node. I found some
additional cases involving Append nodes that weren't handled by the
prior patch, and it's not clear how to fix them in the same way without
breaking inheritance cases. So the prudent path seems to be to narrow
the scope of the optimization.
Tom Lane [Mon, 5 Sep 2005 17:25:01 +0000 (17:25 +0000)]
For non-projecting plan node types such as Limit, set_plan_references
has to recopy the input plan node's targetlist if it removes a
SubqueryScan node just below the non-projecting node. For simplicity
I made it recopy always. Per bug report from Allan Wang and Michael Fuhr.
Bruce Momjian [Sat, 3 Sep 2005 00:41:30 +0000 (00:41 +0000)]
Add idea:
< cmin/cmax pair and is stored in local memory.
> cmin/cmax pair and is stored in local memory. Another idea is to
> store both cmin and cmax only in local memory.
Bruce Momjian [Fri, 2 Sep 2005 21:23:05 +0000 (21:23 +0000)]
Update.
< have its heap and index files truncated. One issue is
< that no other backend should be able to add to the table
< at the same time, which is something that is currently
< allowed.
> removed or have its heap and index files truncated. One
> issue is that no other backend should be able to add to
> the table at the same time, which is something that is
> currently allowed.
Bruce Momjian [Fri, 2 Sep 2005 21:10:59 +0000 (21:10 +0000)]
Update:
> o Allow COPY on a newly-created table to skip WAL logging 450a452,456
> On crash recovery, the table involved in the COPY would
> have its heap and index files truncated. One issue is
> that no other backend should be able to add to the table
> at the same time, which is something that is currently
> allowed.
Bruce Momjian [Fri, 2 Sep 2005 20:11:34 +0000 (20:11 +0000)]
Add:
> * Use UTF8 encoding for NLS messages so all server encodings can
> read them properly
< o %Add support for Unicode
<
< To fix this, the data needs to be converted to/from UTF16/UTF8
< so the Win32 wcscoll() can be used, and perhaps other functions
< like towupper(). However, UTF8 already works with normal
< locales but provides no ordering or character set classes.
Bruce Momjian [Fri, 2 Sep 2005 19:51:37 +0000 (19:51 +0000)]
Update wording:
< could only see committed rows from another transaction. However,
> could only see rows from another completed transaction. However, 981c981
< proper visibility of the row, for example, for cursors.
> proper visibility of the row's cmin, for example, for cursors.
Tom Lane [Fri, 2 Sep 2005 19:02:20 +0000 (19:02 +0000)]
Clean up a couple of ad-hoc computations of the maximum number of tuples
on a page, as suggested by ITAGAKI Takahiro. Also, change a few places
that were using some other estimates of max-items-per-page to consistently
use MaxOffsetNumber. This is conservatively large --- we could have used
the new MaxHeapTuplesPerPage macro, or a similar one for index tuples ---
but those places are simply declaring a fixed-size buffer and assuming it
will work, rather than actively testing for overrun. It seems safer to
size these buffers in a way that can't overflow even if the page is
corrupt.
Tom Lane [Fri, 2 Sep 2005 18:55:32 +0000 (18:55 +0000)]
In copy_file, use a palloc'd buffer instead of just a local char array;
a local array isn't guaranteed to have any particular alignment, and
so it could slow down the data transfer.
Bruce Momjian [Fri, 2 Sep 2005 15:22:44 +0000 (15:22 +0000)]
Add text:
* Merge xmin/xmax/cmin/cmax back into three header fields
Before subtransactions, there used to be only three fields needed to
store these four values. This was possible because only the current
transaction looks at the cmin/cmax values. If the current transaction
created and expired the row the fields stored where xmin (same as
xmax), cmin, cmax, and if the transaction was expiring a row from a
another transaction, the fields stored were xmin (cmin was not
needed), xmax, and cmax. Such a system worked because a transaction
could only see committed rows from another transaction. However,
subtransactions can see rows from outer transactions, and once the
subtransaction completes, the outer transaction continues, requiring
the storage of all four fields. With subtransactions, an outer
transaction can create a row, a subtransaction expire it, and when the
subtransaction completes, the outer transaction still has to have
proper visibility of the row, for example, for cursors.
One possible solution is to create a phantom cid which represents a
cmin/cmax pair and is stored in local memory.
Tom Lane [Fri, 2 Sep 2005 00:57:57 +0000 (00:57 +0000)]
Update performance discussion for 8.1. Add a little more explanatory
material in the EXPLAIN section, update examples to match current reality,
show examples of bitmap indexscans as well as plain ones.
Bruce Momjian [Fri, 2 Sep 2005 00:49:57 +0000 (00:49 +0000)]
Duplicate:
< * Maintain a map of recently-expired rows
<
< This allows vacuum to target specific pages for possible free space
< without requiring a sequential scan.
<
Update entry:
> One complexity is that index entries still have to be vacuumed, and
> doing this without an index scan (by using the heap values to find the
> index entry) might be slow and unreliable, especially for user-defined
> index functions.