Commit Graph

6185 Commits

Author SHA1 Message Date
Magnus Hagander 9b8aff8c19 Add REPLICATION privilege for ROLEs
This privilege is required to do Streaming Replication, instead of
superuser, making it possible to set up a SR slave that doesn't
have write permissions on the master.

Superuser privileges do NOT override this check, so in order to
use the default superuser account for replication it must be
explicitly granted the REPLICATION permissions. This is backwards
incompatible change, in the interest of higher default security.
2010-12-29 11:05:03 +01:00
Tom Lane 31d2efaef5 Reclassify DEFAULT as a column_constraint item in the CREATE TABLE syntax.
This is how it was documented originally, but several years ago somebody
decided that DEFAULT isn't a type of constraint.  Well, the grammar thinks
it is.  The documentation was wrong in two ways: it alleged that DEFAULT
had to appear before any other kind of constraint, and it alleged that you
can't prefix a DEFAULT clause with a "CONSTRAINT name" clause, when in fact
you can.  (The latter behavior probably isn't SQL-standard, but our grammar
has always allowed it.)

This patch responds to Fujii Masao's observation that the ALTER TABLE
documentation mistakenly implied that you couldn't include DEFAULT in
ALTER TABLE ADD COLUMN; though this isn't the way he proposed fixing it.
2010-12-28 21:38:05 -05:00
Peter Eisentraut a5f96409fd No release notes update, just advance the date 2010-12-28 21:19:17 +02:00
Tom Lane 81a530a65e Fix ill-advised placement of PGRES_COPY_BOTH enum value.
It must be added at the end of the ExecStatusType enum to avoid ABI
breakage compared to previous libpq versions.  Noted by Magnus.
2010-12-28 11:02:10 -05:00
Magnus Hagander 06004319be Fix list of functions that are restricted to superusers
Move the list of what's restricted to superusers into the table
itself, so it doesn't get missed again.
2010-12-28 10:46:03 +01:00
Bruce Momjian 0a023a14fc Update SGML docs describing the contents of the postmaster.pid file,
per change to the file for pg_ctl.
2010-12-27 15:20:28 -05:00
Alvaro Herrera c7f0038d73 Break up long line, per Leslie S Satenstein. 2010-12-27 12:36:51 -03:00
Robert Haas 63676ebff4 Corrections to patch adding SQL/MED error codes.
My previous commit, 85cff3ce7f on
2010-12-25, failed to update errcodes.sgml or plerrcodes.h.  This patch
corrects that oversight, per a gripe from Tom Lane, and also corrects
a typographical error.
2010-12-26 21:35:25 -05:00
Robert Haas 4ec92b05e6 Correct spelling: longjump() -> longjmp(). 2010-12-24 22:22:44 -05:00
Peter Eisentraut 79a9decdd3 Fix grammar 2010-12-24 22:08:50 +02:00
Bruce Momjian 075354ad1b Improve "pg_ctl -w start" server detection by writing the postmaster
port and socket directory into postmaster.pid, and have pg_ctl read from
that file, for use by PQping().
2010-12-24 09:45:52 -05:00
Peter Eisentraut 4b1742a192 Move the documentation of --no-security-label to a more sensible place
The order on the pg_dump/pg_dumpall man pages is not very strict, but
surely putting it under connection options was wrong.
2010-12-24 14:11:11 +02:00
Peter Eisentraut b2fd345ab9 Release notes for 9.1alpha3 2010-12-24 13:50:34 +02:00
Robert Haas a1b0035949 Document pg_dump(all) --no-security-label instead of --security-label.
The former is the option actually supported by these commands.
2010-12-23 23:22:40 -05:00
Heikki Linnakangas 9de3aa65f0 Rewrite the GiST insertion logic so that we don't need the post-recovery
cleanup stage to finish incomplete inserts or splits anymore. There was two
reasons for the cleanup step:

1. When a new tuple was inserted to a leaf page, the downlink in the parent
needed to be updated to contain (ie. to be consistent with) the new key.
Updating the parent in turn might require recursively updating the parent of
the parent. We now handle that by updating the parent while traversing down
the tree, so that when we insert the leaf tuple, all the parents are already
consistent with the new key, and the tree is consistent at every step.

2. When a page is split, we need to insert the downlink for the new right
page(s), and update the downlink for the original page to not include keys
that moved to the right page(s). We now handle that by setting a new flag,
F_FOLLOW_RIGHT, on the non-rightmost pages in the split. When that flag is
set, scans always follow the rightlink, regardless of the NSN mechanism used
to detect concurrent page splits. That way the tree is consistent right after
split, even though the downlink is still missing. This is very similar to the
way B-tree splits are handled. When the downlink is inserted in the parent,
the flag is cleared. To keep the insertion algorithm simple, when an
insertion sees an incomplete split, indicated by the F_FOLLOW_RIGHT flag, it
finishes the split before doing anything else.

These changes allow removing the whole "invalid tuple" mechanism, but I
retained the scan code to still follow invalid tuples correctly. While we
don't create any such tuples anymore, we want to handle them gracefully in
case you pg_upgrade a GiST index that has them. If we encounter any on an
insert, though, we just throw an error saying that you need to REINDEX.

The issue that got me into doing this is that if you did a checkpoint while
an insert or split was in progress, and the checkpoint finishes quickly so
that there is no WAL record related to the insert between RedoRecPtr and the
checkpoint record, recovery from that checkpoint would not know to finish
the incomplete insert. IOW, we have the same issue we solved with the
rm_safe_restartpoint mechanism during normal operation too. It's highly
unlikely to happen in practice, and this fix is far too large to backpatch,
so we're just going to live with in previous versions, but this refactoring
fixes it going forward.

With this patch, you don't get the annoying
'index "FOO" needs VACUUM or REINDEX to finish crash recovery' notices
anymore if you crash at an unfortunate moment.
2010-12-23 16:21:47 +02:00
Bruce Momjian 7a1ca8977f Document that BBU's do not allow partial page writes to be safely turned
off unless they guarantee that all writes to the BBU arrive in 8kB chunks.

Per discussion with Greg Smith
2010-12-22 21:12:00 -05:00
Robert Haas 2a0f13a765 Typo fix.
Noted by Thom Brown.
2010-12-22 09:33:34 -05:00
Bruce Momjian 28d5c565ce Wording improvements for pg_ctl manual page. 2010-12-22 09:11:33 -05:00
Magnus Hagander de9a4c27fe Add PQlibVersion() function to libpq
This function is like the PQserverVersion() function except
it returns the version of libpq, making it possible for a client
program or driver to determine which version of libpq is in
use at runtime, and not just at link time.

Suggested by Harald Armin Massa and several others.
2010-12-22 14:23:56 +01:00
Alvaro Herrera f9e9763b62 Fix typo
Jaime Casanova
2010-12-20 12:05:12 -03:00
Magnus Hagander dcb09b595f Support for collecting crash dumps on Windows
Add support for collecting "minidump" style crash dumps on
Windows, by setting up an exception handling filter. Crash
dumps will be generated in PGDATA/crashdumps if the directory
is created (the existance of the directory is used as on/off
switch for the generation of the dumps).

Craig Ringer and Magnus Hagander
2010-12-19 16:45:28 +01:00
Robert Haas df142bf82c Waiting for complete startup is now a well-defined operation.
Per report from Fujii Masao, and subsequent discussion.
2010-12-16 20:57:33 -05:00
Robert Haas 290f1603b4 Some copy editing of pg_read_binary_file() patch. 2010-12-15 21:02:31 -05:00
Robert Haas afc8f47b58 Document timestamptz a little better. 2010-12-15 20:53:40 -05:00
Itagaki Takahiro 03db44eae3 Add pg_read_binary_file() and whole-file-at-once versions of pg_read_file().
One of the usages of the binary version is to read files in a different
encoding from the server encoding.

Dimitri Fontaine and Itagaki Takahiro.
2010-12-16 06:56:28 +09:00
Bruce Momjian 16b5e08dec Use "upgrade" in preference over "migrate" in pg_upgrade messages and
documentation.  (Many were left over from the old pg_migrator naming.)
2010-12-15 07:11:31 -05:00
Tom Lane f9224c8ec2 Update release notes for releases 9.0.2, 8.4.6, 8.3.13, 8.2.19, and 8.1.23. 2010-12-13 20:22:52 -05:00
Peter Eisentraut 843a490f0a Remove recently reintroduced CVS keyword 2010-12-13 23:22:52 +02:00
Robert Haas d26849ee26 Document replacement of pg_class.relistemp with relpersistence.
Noted by Tom Lane.
2010-12-13 13:08:45 -05:00
Robert Haas d3d414696f Allow bidirectional copy messages in streaming replication mode.
Fujii Masao.  Review by Alvaro Herrera, Tom Lane, and myself.
2010-12-11 09:27:37 -05:00
Robert Haas 1490946c57 Minor documentation cleanup.
Fujii Masao
2010-12-10 23:22:50 -05:00
Tom Lane 576477e73c Force default wal_sync_method to be fdatasync on Linux.
Recent versions of the Linux system header files cause xlogdefs.h to
believe that open_datasync should be the default sync method, whereas
formerly fdatasync was the default on Linux.  open_datasync is a bad
choice, first because it doesn't actually outperform fdatasync (in fact
the reverse), and second because we try to use O_DIRECT with it, causing
failures on certain filesystems (e.g., ext4 with data=journal option).
This part of the patch is largely per a proposal from Marti Raudsepp.
More extensive changes are likely to follow in HEAD, but this is as much
change as we want to back-patch.

Also clean up confusing code and incorrect documentation surrounding the
fsync_writethrough option.  Those changes shouldn't result in any actual
behavioral change, but I chose to back-patch them anyway to keep the
branches looking similar in this area.

In 9.0 and HEAD, also do some copy-editing on the WAL Reliability
documentation section.

Back-patch to all supported branches, since any of them might get used
on modern Linux versions.
2010-12-08 20:01:09 -05:00
Simon Riggs e620ee35b2 Optimize commit_siblings in two ways to improve group commit.
First, avoid scanning the whole ProcArray once we know there
are at least commit_siblings active; second, skip the check
altogether if commit_siblings = 0.

Greg Smith
2010-12-08 18:48:03 +00:00
Tom Lane b525bf771e Add KNNGIST support to contrib/pg_trgm.
Teodor Sigaev, with some revision by Tom
2010-12-04 00:16:21 -05:00
Tom Lane b576757d7e Add external documentation for KNNGIST. 2010-12-03 23:49:06 -05:00
Robert Haas c0a4d3e051 Clarify that LOCK TABLE requires a table-level privilege. 2010-12-03 09:29:14 -05:00
Tom Lane d583f10b7e Create core infrastructure for KNNGIST.
This is a heavily revised version of builtin_knngist_core-0.9.  The
ordering operators are no longer mixed in with actual quals, which would
have confused not only humans but significant parts of the planner.
Instead, ordering operators are carried separately throughout planning and
execution.

Since the API for ambeginscan and amrescan functions had to be changed
anyway, this commit takes the opportunity to rationalize that a bit.
RelationGetIndexScan no longer forces a premature index_rescan call;
instead, callers of index_beginscan must call index_rescan too.  Aside from
making the AM-side initialization logic a bit less peculiar, this has the
advantage that we do not make a useless extra am_rescan call when there are
runtime key values.  AMs formerly could not assume that the key values
passed to amrescan were actually valid; now they can.

Teodor Sigaev and Tom Lane
2010-12-02 20:51:37 -05:00
Heikki Linnakangas 3c42efceb2 Be consistent about writing "[, ...]" instead "[,...]" in the docs.
Christoph Berg.
2010-11-29 11:53:27 +02:00
Tom Lane c623365ff9 Point out in default_tablespace's description that CREATE DATABASE ignores it.
Per gripe from Andreas Scherbaum.
2010-11-27 16:08:32 -05:00
Robert Haas fe7a32fc87 New contrib module, auth_delay.
KaiGai Kohei, with a few changes by me.
2010-11-27 07:22:25 -05:00
Tom Lane d53c1255d9 A bit more wordsmithing on the PQping documentation. 2010-11-27 02:42:22 -05:00
Tom Lane db96e1ccfc Rewrite PQping to be more like what we agreed to last week.
Basically, we want to distinguish all cases where the connection was
not made from those where it was.  A convenient proxy for this is to
see if we got a message with a SQLSTATE code back from the postmaster.
This presumes that the postmaster will always send us a SQLSTATE in
a failure message, which is true for 7.4 and later postmasters in
every case except fork failure.  (We could possibly complicate the
postmaster code to do something about that, but it seems not worth
the trouble, especially since pg_ctl's response for that case should
be to keep waiting anyway.)

If we did get a SQLSTATE from the postmaster, there are basically only
two cases, as per last week's discussion: ERRCODE_CANNOT_CONNECT_NOW
and everything else.  Any other error code implies that the postmaster
is in principle willing to accept connections, it just didn't like or
couldn't handle this particular request.  We want to make a special
case for ERRCODE_CANNOT_CONNECT_NOW so that "pg_ctl start -w" knows
it should keep waiting.

In passing, pick names for the enum constants that are a tad less
likely to present collision hazards in future.
2010-11-27 01:30:34 -05:00
Robert Haas 55109313f9 Add more ALTER <object> .. SET SCHEMA commands.
This adds support for changing the schema of a conversion, operator,
operator class, operator family, text search configuration, text search
dictionary, text search parser, or text search template.

Dimitri Fontaine, with assorted corrections and other kibitzing.
2010-11-26 17:31:54 -05:00
Bruce Momjian afd7d9adca Add PQping and PQpingParams to libpq to allow detection of the server's
status, including a status where the server is running but refuses a
postgres connection.

Have pg_ctl use this new function.  This fixes the case where pg_ctl
reports that the server is not running (cannot connect) but in fact it
is running.
2010-11-25 13:09:38 -05:00
Bruce Momjian 7276ab5888 Document that a CHECKPOINT before taking a file system snapshot can
reduce recovery time.
2010-11-24 18:41:28 -05:00
Bruce Momjian ba11258ccb When reporting the server as not responding, if the hostname was
supplied, also print the IP address.  This allows IPv4 and IPv6 failures
to be distinguished.  Also useful when a hostname resolves to multiple
IP addresses.

Also, remove use of inet_ntoa() and use our own inet_net_ntop() in all
places, including in libpq, because it is thread-safe.
2010-11-24 17:04:19 -05:00
Tom Lane 725d52d0c2 Create the system catalog infrastructure needed for KNNGIST.
This commit adds columns amoppurpose and amopsortfamily to pg_amop, and
column amcanorderbyop to pg_am.  For the moment all the entries in
amcanorderbyop are "false", since the underlying support isn't there yet.

Also, extend the CREATE OPERATOR CLASS/ALTER OPERATOR FAMILY commands with
[ FOR SEARCH | FOR ORDER BY sort_operator_family ] clauses to allow the new
columns of pg_amop to be populated, and create pg_dump support for dumping
that information.

I also added some documentation, although it's perhaps a bit premature
given that the feature doesn't do anything useful yet.

Teodor Sigaev, Robert Haas, Tom Lane
2010-11-24 14:22:17 -05:00
Peter Eisentraut 4fc09ad00c Add index entries for more functions
Also, move index entries into the tables, closer to the function description,
for easier editing in the future.  Resort some tables to be more alphabetical.
Remove the entries for count, max, min, and sum in the tutorial area, because
that was felt to be confusing.

Thom Brown
2010-11-24 00:00:34 +02:00
Peter Eisentraut f2a4278330 Propagate ALTER TYPE operations to typed tables
This adds RESTRICT/CASCADE flags to ALTER TYPE ... ADD/DROP/ALTER/
RENAME ATTRIBUTE to control whether to alter typed tables as well.
2010-11-23 22:50:17 +02:00
Peter Eisentraut fc946c39ae Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00