Commit Graph

24256 Commits

Author SHA1 Message Date
Tom Lane f44271176e Call pgstat_drop_database during DROP DATABASE, so that any stats file
entries for the victim database go away sooner rather than later.  We already
did the equivalent thing at the per-relation level, not sure why it's not
been done for whole databases.  With this change, pgstat_vacuum_tabstat
should usually not find anything to do; though we still need it as a backstop
in case DROPDB or TABPURGE messages get lost under load.
2007-02-09 16:12:19 +00:00
Peter Eisentraut c138b966d4 Replace useless uses of := by = in makefiles. 2007-02-09 15:56:00 +00:00
Bruce Momjian d7fee591db Remove blank lines in code. 2007-02-09 04:17:58 +00:00
Bruce Momjian bc6fb5436f Update FAQ for new 24-byte header, down from 28. 2007-02-09 03:43:22 +00:00
Bruce Momjian 1ad2f04bf2 Add blank line. 2007-02-09 03:39:59 +00:00
Bruce Momjian 9eddc28197 Add URL for:
<
>   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00435.php
2007-02-09 03:39:39 +00:00
Bruce Momjian 19d561cbd0 Done!
< * 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 rows from another completed 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's cmin, 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.  Another idea is to
<   store both cmin and cmax only in local memory.
<
> * -Merge xmin/xmax/cmin/cmax back into three header fields
2007-02-09 03:37:45 +00:00
Tom Lane c398300330 Combine cmin and cmax fields of HeapTupleHeaders into a single field, by
keeping private state in each backend that has inserted and deleted the same
tuple during its current top-level transaction.  This is sufficient since
there is no need to be able to determine the cmin/cmax from any other
transaction.  This gets us back down to 23-byte headers, removing a penalty
paid in 8.0 to support subtransactions.  Patch by Heikki Linnakangas, with
minor revisions by moi, following a design hashed out awhile back on the
pghackers list.
2007-02-09 03:35:35 +00:00
Bruce Momjian acb3416686 Remove blank line from C code. 2007-02-09 03:15:48 +00:00
Bruce Momjian aba039df66 Update:
< * Consider placing all sequences in a single table
> * Consider placing all sequences in a single table, or create a system
>   view
2007-02-09 01:29:48 +00:00
Bruce Momjian 5bdf44c647 Update:
< * Consider placing all sequences in a single table, now that system
<   tables are full transactional
> * Consider placing all sequences in a single table
2007-02-09 00:34:31 +00:00
Bruce Momjian 18d36f9e19 Add:
> * Consider placing all sequences in a single table, now that system
>   tables are full transactional
2007-02-09 00:32:15 +00:00
Bruce Momjian 2737f304ca Add URL for:
* Add support for SQL-standard GENERATED/IDENTITY columns
>   http://archives.postgresql.org/pgsql-hackers/2006-08/msg00038.php
2007-02-08 21:51:50 +00:00
Tom Lane 4a30da1e7f Add missing #define for mingw, per Magnus. 2007-02-08 19:48:28 +00:00
Tom Lane fe796ea8ac Fix an ancient logic error in plpgsql's exec_stmt_block: it thought it could
get away with not (re)initializing a local variable if the variable is marked
"isconst" and not "isnull".  Unfortunately it makes this decision after having
already freed the old value, meaning that something like

   for i in 1..10 loop
     declare c constant text := 'hi there';

leads to subsequent accesses to freed memory, and hence probably crashes.
(In particular, this is why Asif Ali Rehman's bug leads to crash and not
just an unexpectedly-NULL value for SQLERRM: SQLERRM is marked CONSTANT
and so triggers this error.)

The whole thing seems wrong on its face anyway: CONSTANT means that you can't
change the variable inside the block, not that the initializer expression is
guaranteed not to change value across successive block entries.  Hence,
remove the "optimization" instead of trying to fix it.
2007-02-08 18:37:30 +00:00
Tom Lane 7ad33cebfd Rearrange use of plpgsql_add_initdatums() so that only the parsing of a
DECLARE section needs to know about it.  Formerly, everyplace besides DECLARE
that created variables needed to do "plpgsql_add_initdatums(NULL)" to prevent
those variables from being sucked up as part of a subsequent DECLARE block.
This is obviously error-prone, and in fact the SQLSTATE/SQLERRM patch had
failed to do it for those two variables, leading to the bug recently exhibited
by Asif Ali Rehman: a DECLARE within an exception handler tried to reinitialize
SQLERRM.

Although the SQLSTATE/SQLERRM patch isn't in any pre-8.1 branches, and so
I can't point to a demonstrable failure there, it seems wise to back-patch
this into the older branches anyway, just to keep the logic similar to HEAD.
2007-02-08 18:37:14 +00:00
Bruce Momjian b577aa9ebc Fix bug when localized to_char() day or month names were incorectly
trnasformed to lower or upper string.

Pavel Stehule
2007-02-08 18:19:33 +00:00
Bruce Momjian a37b006d89 This patch fixes shared_preload_libraries on Windows hosts. It forces
ach backend to re-load all shared_preload_libraries.

Korry Douglas
2007-02-08 15:46:04 +00:00
Bruce Momjian eea3749d2e Add lock matrix to documentation.
Teodor Sigaev
2007-02-08 15:32:11 +00:00
Bruce Momjian 6fea31b693 Win32 regression test fixes:
For win32 in general, this makes it possible to run the regression tests
as an admin user by using the same restricted token method that's used
by pg_ctl and initdb.

For vc++, it adds building of pg_regress.exe, adds a resultmap, and
fixes how it runs the install.

Magnus Hagander
2007-02-08 15:28:58 +00:00
Bruce Momjian 51be14e928 Add /contrib/pg_standby:
pg_standby is a production-ready program that can be used to
  create a Warm Standby server. Other configuration is required
  as well, all of which is described in the main server manual.

Simon Riggs
2007-02-08 15:16:19 +00:00
Bruce Momjian 528779a2c6 Add /contrib/pg_standby:
pg_standby is a production-ready program that can be used to
  create a Warm Standby server. Other configuration is required
  as well, all of which is described in the main server manual.

Simon Riggs
2007-02-08 15:09:47 +00:00
Alvaro Herrera f8ebab901b Fix reference-after-free in the new btree page split code, as reported by
the buildfarm via Stefan Kaltenbrunner.

Patch from Heikki Linnakangas.
2007-02-08 13:52:55 +00:00
Peter Eisentraut 086c189456 Normalize fgets() calls to use sizeof() for calculating the buffer size
where possible, and fix some sites that apparently thought that fgets()
will overwrite the buffer by one byte.

Also add some strlcpy() to eliminate some weird memory handling.
2007-02-08 11:10:27 +00:00
Bruce Momjian b79575ce45 Reduce WAL activity for page splits:
> Currently, an index split writes all the data on the split page to
> WAL. That's a lot of WAL traffic. The tuples that are copied to the
> right page need to be WAL logged, but the tuples that stay on the
> original page don't.

Heikki Linnakangas
2007-02-08 05:05:53 +00:00
Bruce Momjian fe03a5f4ae Check if the role exists before doing more complex ident and Kerberos
authentication checks in the backend.

Gavin Sherry
2007-02-08 04:52:18 +00:00
Bruce Momjian b227448d0b Update URL for "Generalized Partial Indexes" paper to point to a cached
version.

Backpatch to 8.2.X.
2007-02-08 04:31:37 +00:00
Bruce Momjian d78f76896b Document that wal_sync_method open_* methods use O_DIRECT, if available.
Backpatch to 8.2.X.
2007-02-08 03:56:42 +00:00
Bruce Momjian 9e9e387ecf Fix bug in our code when using to_timestamp() or to_date() without "TM".
Assume "TM" when input fields are variable-length, like month or day
names.  This matches Oracle behavior.
2007-02-08 03:22:28 +00:00
Tom Lane aec4cf1c8c Add a function pg_stat_clear_snapshot() that discards any statistics snapshot
already collected in the current transaction; this allows plpgsql functions to
watch for stats updates even though they are confined to a single transaction.
Use this instead of the previous kluge involving pg_stat_file() to wait for
the stats collector to update in the stats regression test.  Internally,
decouple storage of stats snapshots from transaction boundaries; they'll
now stick around until someone calls pgstat_clear_snapshot --- which xact.c
still does at transaction end, to maintain the previous behavior.  This makes
the logic a lot cleaner, at the price of a couple dozen cycles per transaction
exit.
2007-02-07 23:11:30 +00:00
Tom Lane d9ce68872f Modify the stats regression test to delay until the stats file actually
changes (with an upper limit of 30 seconds), and record the delay time in
the postmaster log.  This should give us some info about what's happening
with the intermittent stats failures in buildfarm.  After an idea of
Andrew Dunstan's.
2007-02-07 18:34:56 +00:00
Tom Lane 78d1216160 Remove the xlog-centric "database system is ready" message and replace it with
"database system is ready to accept connections", which is issued by the
postmaster when it really is ready to accept connections.  Per proposal from
Markus Schiltknecht and subsequent discussion.
2007-02-07 16:44:48 +00:00
Alvaro Herrera 53d7d49011 The VC++ build needs to compile the new strlcat.c file. Patch from Magnus
Hagander.
2007-02-07 13:37:42 +00:00
Bruce Momjian a3f9a054c1 Stamp bug template for 8.3. 2007-02-07 05:14:08 +00:00
Bruce Momjian cf230f2299 Stamp releases notes for 8.2.3, 8.1.8, 8.0.12. 2007-02-07 04:22:44 +00:00
Bruce Momjian ced5269a8b Update for 8.2.3. 2007-02-07 03:16:22 +00:00
Peter Eisentraut 16059d39a0 Replace some strncpy() by strlcpy(). 2007-02-07 00:52:35 +00:00
Peter Eisentraut f11aa82d03 Use memcpy() instead of strncpy() for copying into varlena structures. 2007-02-07 00:32:15 +00:00
Peter Eisentraut 4f64a07bee Add strlcat() from OpenBSD, to be used for replacing strncat and other
strange coding practices.
2007-02-07 00:28:55 +00:00
Tom Lane 5b706ba481 Fix an error in the original coding of holdable cursors: PersistHoldablePortal
thought that it didn't have to reposition the underlying tuplestore if the
portal is atEnd.  But this is not so, because tuplestores have separate read
and write cursors ... and the read cursor hasn't moved from the start.
This mistake explains bug #2970 from William Zhang.

Note: the coding here is pretty inefficient, but given that no one has noticed
this bug until now, I'd say hardly anyone uses the case where the cursor has
been advanced before being persisted.  So maybe it's not worth worrying about.
2007-02-06 22:49:24 +00:00
Bruce Momjian 09f9553daf Update for 8.2.2 as most recent release. 2007-02-06 18:36:26 +00:00
Bruce Momjian 63b7afbe4f Update workding for daylight savings time. 2007-02-06 18:33:20 +00:00
Bruce Momjian a85a290dad Update timezone FAQ item:
<P>USA saving time changes are included in PostgreSQL release 8.0.[4+],
    and all later major releases, e.g. 8.1.  Canada and Western Australia
    changes are included in 8.0.[10+], 8.1.[6+], and all later major
    releases.  PostgreSQL releases prior to 8.0 use the operating system's
    timezone database for daylight saving information.</P>
2007-02-06 18:31:26 +00:00
Tom Lane a8c3f161fb Remove typmod checking from the recent security-related patches. It turns
out that ExecEvalVar and friends don't necessarily have access to a tuple
descriptor with correct typmod: it definitely can contain -1, and possibly
might contain other values that are different from the Var's value.
Arguably this should be cleaned up someday, but it's not a simple change,
and in any case typmod discrepancies don't pose a security hazard.
Per reports from numerous people :-(

I'm not entirely sure whether the failure can occur in 8.0 --- the simple
test cases reported so far don't trigger it there.  But back-patch the
change all the way anyway.
2007-02-06 17:35:20 +00:00
Bruce Momjian 869585cc8f Split apart entries, one done now:
* -Move NAMEDATALEN from postgres_ext.h to pg_config_manual.h
* Consider making NAMEDATALEN more configurable in future releases
2007-02-06 16:44:14 +00:00
Tom Lane 28c3cd5c1c Fix typo in comment. 2007-02-06 16:20:23 +00:00
Tom Lane c76ed81513 Remove some dead code, per Heikki. 2007-02-06 14:55:11 +00:00
Peter Eisentraut 037f8413fa Move NAMEDATALEN definition from postgres_ext.h to pg_config_manual.h. It
used to be part of libpq's exported interface many releases ago, but now
it's no longer necessary to make it accessible to clients.
2007-02-06 09:16:08 +00:00
Tom Lane 56e59edd75 Fix a performance regression in 8.2: optimization of MIN/MAX into indexscans
had stopped working for tables buried inside views or sub-selects.  This is
because I had gotten rid of the simplify_jointree() preprocessing step, and
optimize_minmax_aggregates() wasn't smart enough to deal with a non-canonical
FromExpr.  Per gripe from Bill Howe.
2007-02-06 06:50:26 +00:00
Tom Lane 91e18dbbcc Docs updates for cross-type hashing. 2007-02-06 04:38:31 +00:00