Tom Lane [Tue, 9 Nov 2004 00:34:46 +0000 (00:34 +0000)]
Use a hopefully-more-reliable method of detecting default selectivity
estimates when combining the estimates for a range query. As pointed out
by Miquel van Smoorenburg, the existing check for an impossible combined
result would quite possibly fail to detect one default and one non-default
input. It seems better to use the default range query estimate in such
cases. To do so, add a check for an estimate of exactly DEFAULT_INEQ_SEL.
This is a bit ugly because it introduces additional coupling between
clauselist_selectivity and scalarltsel/scalargtsel, but it's not like
there wasn't plenty already...
Bruce Momjian [Mon, 8 Nov 2004 20:16:20 +0000 (20:16 +0000)]
Update:
< posix_fadvise() [fadvise]
> posix_fadvise()
>
> Posix_fadvise() can control both sequential/random file caching and
> free-behind behavior, but it is unclear how the setting affects other
> backends that also have the file open, and the feature is not supported
> on all operating systems.
>
Tom Lane [Mon, 8 Nov 2004 18:01:28 +0000 (18:01 +0000)]
Recommend that archive_command be coded to not overwrite existing files.
Add explicit documentation of the recovery configuration settings. Other
minor improvements in the PITR docs. Simon Riggs, some editorialization
by Tom Lane.
Bruce Momjian [Mon, 8 Nov 2004 15:18:16 +0000 (15:18 +0000)]
Update item description:
< * CREATE TABLE AS can not determine column lengths from expressions [atttypmod]
> * Allow CREATE TABLE AS to determine column lengths for complex
> expressions like SELECT col1 || col2
Bruce Momjian [Mon, 8 Nov 2004 14:54:00 +0000 (14:54 +0000)]
Update view info:
< * Automatically create rules on views so they are updateable, per SQL99 [view]
> * Automatically create rules on views so they are updateable, per SQL99
>
> We can only auto-create rules for simple views. For more complex
> cases users will still have to write rules.
>
Tom Lane [Mon, 8 Nov 2004 04:02:20 +0000 (04:02 +0000)]
Kris Jurka pointed out that the qualified_name production wasn't
working as intended --- for some reason, FROM a.b.c was getting
parsed as if it were a function name and not a qualified name.
I think there must be a bug in bison, because it should have
complained that the grammar was ambiguous. Anyway, fix it along
the same lines previously used for func_name vs columnref, and get
rid of the right-recursion in attrs that seems to have confused
bison.
Tom Lane [Sat, 6 Nov 2004 23:06:29 +0000 (23:06 +0000)]
Add code to find_my_exec() to resolve a symbolic link down to the
actual executable location. This allows people to continue to use
setups where, eg, postmaster is symlinked from a convenient place.
Per gripe from Josh Berkus.
Tom Lane [Sat, 6 Nov 2004 19:36:02 +0000 (19:36 +0000)]
Update pg_dump to use SET DEFAULT_TABLESPACE instead of explicit
tablespace clauses; this should improve compatibility of dump files.
Philip Warner, some rework by Tom Lane.
Tom Lane [Sat, 6 Nov 2004 17:46:38 +0000 (17:46 +0000)]
When implementing a coercion to a domain type with a combined
type-and-length coercion function, make sure that the coercion function
is told the correct typmod. Fixes Kris Jurka's example of a domain
over bit(N).
Bruce Momjian [Sat, 6 Nov 2004 05:38:19 +0000 (05:38 +0000)]
Remove:
* Allow database recovery where tablespaces can't be created
When a pg_dump is restored, all tablespaces will attempt to be created
in their original locations. If this fails, the user must be able to
adjust the restore process.
Tom Lane [Sat, 6 Nov 2004 01:16:22 +0000 (01:16 +0000)]
Code cleanup in path.c and exec.c. Handle Windows drive and network specs
everywhere not just some places, get rid of . and .. when joining path
sections together. This should eliminate most of the ugly paths like
/foo/bar/./baz that we've been generating.
Tom Lane [Fri, 5 Nov 2004 19:17:13 +0000 (19:17 +0000)]
Create 'default_tablespace' GUC variable that supplies a TABLESPACE
clause implicitly whenever one is not given explicitly. Remove concept
of a schema having an associated tablespace, and simplify the rules for
selecting a default tablespace for a table or index. It's now just
(a) explicit TABLESPACE clause; (b) default_tablespace if that's not an
empty string; (c) database's default. This will allow pg_dump to use
SET commands instead of tablespace clauses to determine object locations
(but I didn't actually make it do so). All per recent discussions.
Bruce Momjian [Thu, 4 Nov 2004 16:49:53 +0000 (16:49 +0000)]
Updates from Simon Riggs:
< that can spam more than one table.
> that can span more than one table. 239c239
< rather than just col1
> rather than just col1; also called skip-scanning. 641c641,642
< * Add free-behind capability for large sequential scans [fadvise]
> * Allow free-behind capability for large sequential scans, perhaps using
> posix_fadvise() [fadvise]
Bruce Momjian [Thu, 4 Nov 2004 16:19:46 +0000 (16:19 +0000)]
Update bitmap index entries:
< * Allow the creation of bitmap indexes which can be quickly combined
< with other bitmap indexes
> * Allow non-bitmap indexes to be combined by creating bitmaps in memory
259,261c258,259
< combined. Such indexes could be more compact if there are few unique
< value. Also, perhaps they can be lossy requiring a scan of the heap page
< to find matching rows.
> combined. They can index by tid or can be lossy requiring a scan of the
> heap page to find matching rows. 263c261,262
< * Allow non-bitmap indexes to be combined
> * Allow the creation of on-disk bitmap indexes which can be quickly
> combined with other bitmap indexes
265,266c264
< Do lookups on non-bitmap indexes and create bitmaps in memory that can be
< combined with other indexes.
> Such indexes could be more compact if there are few unique value.
Bruce Momjian [Thu, 4 Nov 2004 03:57:58 +0000 (03:57 +0000)]
Update:
< * Use bitmaps to combine existing indexes [performance]
> * Allow the creation of bitmap indexes which can be quickly combined
> with other bitmap indexes
255,257c256,266
< Bitmap indexes allow single indexed columns to be combined to
< dynamically create a composite index to match a specific query. Each
< index is a bitmap, and the bitmaps are AND'ed or OR'ed to be combined.
> Bitmap indexes index single columns that can be combined with other bitmap
> indexes to dynamically create a composite index to match a specific query.
> Each index is a bitmap, and the bitmaps are bitwise AND'ed or OR'ed to be
> combined. Such indexes could be more compact if there are few unique
> value. Also, perhaps they can be lossy requiring a scan of the heap page
> to find matching rows.
>
> * Allow non-bitmap indexes to be combined
>
> Do lookups on non-bitmap indexes and create bitmaps in memory that can be
> combined with other indexes.
Bruce Momjian [Wed, 3 Nov 2004 22:20:52 +0000 (22:20 +0000)]
Update tablespace temp usage item:
< This perhaps should use a round-robin allocation system where several
< tablespaces are used in a cycle. The cycle pointer should be global.
> It could start with a random tablespace from a supplied list and cycle
> through the list.
Bruce Momjian [Tue, 2 Nov 2004 14:49:27 +0000 (14:49 +0000)]
Update:
< * Add a GUC variable to control the tablespace for temporary objects
> * Add a GUC variable to control the tablespace for temporary objects and
> sort files
>
> This perhaps should use a round-robin allocation system where several
> tablespaces are used in a cycle. The cycle pointer should be global.
>
Tom Lane [Mon, 1 Nov 2004 22:00:30 +0000 (22:00 +0000)]
timestamptz_trunc() should only recalculate the timezone when truncating
to DAY precision or coarser; leave the timezone alone when precision is
HOUR or less. This avoids surprises for inputs near a DST transition
time, as per example from Matthew Gabeler-Lee. (The only reason we
recalculate at all is so that outputs that are supposed to represent
days will come out as local midnight, and that's not relevant for sub-day
precision.)
Tom Lane [Mon, 1 Nov 2004 21:34:44 +0000 (21:34 +0000)]
Invent pg_next_dst_boundary() and rewrite DetermineLocalTimeZone() to
use it, as per my proposal of yesterday. This gives us a means of
determining the zone offset to impute to an unlabeled timestamp that
is both efficient and reliable, unlike all our previous tries involving
mktime() and localtime(). The behavior for invalid or ambiguous times
at a DST transition is fixed to be really and truly "assume standard
time", fixing a bug that has come and gone repeatedly but was back
again in 7.4. (There is some ongoing discussion about whether we should
raise an error instead, but for the moment I'll make it do what it was
previously intended to do.)
Bruce Momjian [Mon, 1 Nov 2004 19:21:50 +0000 (19:21 +0000)]
That's just the lovely way windows handles a "segfault". Gotta be really
interesting for MS to catch all those dumps...
Anyway. Oops. Seems I ran my regression tests with the old psql, and
just managed to update the backend, when I tested that patch. Turns out
there are codepaths where we'd access the Critical Section before it was
initialized. Attached patch breaks the initializeation off to a separate
part and adds that one to a much earlier position in the program.
Tom Lane [Sun, 31 Oct 2004 19:14:16 +0000 (19:14 +0000)]
Use psql -q option instead of 2>/dev/null during first invocation
of psql; this should make it easier to diagnose client-side problems,
such as library version mismatch. Also, consistently use -X option
to avoid problems from weird .psqlrc settings.
Tom Lane [Sat, 30 Oct 2004 23:11:27 +0000 (23:11 +0000)]
Invent a new, more thread-safe version of PQrequestCancel, called PQcancel.
Use this new function in psql. Implement query cancellation in psql for
Windows. Code by Magnus Hagander, documentation and minor editorialization
by Tom Lane.
Tom Lane [Sat, 30 Oct 2004 20:53:06 +0000 (20:53 +0000)]
I found a corner case in which it is possible for RI_FKey_check's call
of HeapTupleSatisfiesItself() to trigger a hint-bit update on the tuple:
if the row was updated or deleted by a subtransaction of my own transaction
that was later rolled back. This cannot occur in pre-8.0 of course, so
the hint-bit patch applied a couple weeks ago is OK for existing releases.
But for 8.0 it seems we had better fix things so that RI_FKey_check can
pass the correct buffer number to HeapTupleSatisfiesItself. Accordingly,
add fields to the TriggerData struct to carry the buffer ID(s) for the
old and new tuple(s). There are other possible solutions but this one
seems cleanest; it will allow other AFTER-trigger functions to safely
do tqual.c calls if they want to. Put new fields at end of struct so
that there is no API breakage.
Tom Lane [Sat, 30 Oct 2004 20:44:43 +0000 (20:44 +0000)]
Change COMMIT back to the old behavior of emitting command tag COMMIT,
not ROLLBACK, for the case of COMMIT outside a transaction block.
Alvaro Herrera
Tom Lane [Fri, 29 Oct 2004 19:18:22 +0000 (19:18 +0000)]
Fix failure to think clearly about encoding conversion errors in COPY.
We can't regurgitate the unconverted string as I first thought, because
the elog.c mechanisms will assume the error message data is in the server
encoding and attempt a reverse conversion. Eventually it might be worth
providing a short-circuit path to support this, but for now the simplest
solution is to abandon trying to report back the line contents after a
conversion failure. Per bug report from Sil Lee, 27-Oct-2004.
Tom Lane [Fri, 29 Oct 2004 00:16:08 +0000 (00:16 +0000)]
Add DEBUG1-level logging of checkpoint start and end. Also, reduce the
'recycled log files' and 'removed log files' messages from DEBUG1 to
DEBUG2, replacing them with a count of files added/removed/recycled in
the checkpoint end message, as per suggestion from Simon Riggs.
Neil Conway [Thu, 28 Oct 2004 01:38:41 +0000 (01:38 +0000)]
Use AllocateFile(), FreeFile() and palloc() rather than fopen(), fclose()
and malloc() in pgstat.c, respectively. This simplifies error recovery,
as well as being more consistent with the rest of the backend.
Tom Lane [Thu, 28 Oct 2004 00:39:59 +0000 (00:39 +0000)]
On Windows, force a checkpoint just before dropping a database's physical
files and directories. This ensures that the bgwriter will close any open
file references it is holding for files therein, which is needed for the
rmdir() to succeed. Andrew Dunstan and Tom Lane.
Tom Lane [Wed, 27 Oct 2004 18:09:41 +0000 (18:09 +0000)]
When displaying a Var that is a reference to a column of an unnamed join,
try to display it as a reference to the underlying column instead. This
is a legitimate substitution (it wouldn't be for a named join) and it
fixes some cases where the display would otherwise be ambiguous. Per
example from Sim Zacks.