Commit Graph

7086 Commits

Author SHA1 Message Date
Magnus Hagander ac086d466d Fix some typos and correct wording in the monitoring docs patch
Thom Brown
2012-02-25 16:33:57 +01:00
Magnus Hagander ddfc2d9a37 Merge the list of statistics functions into the view documentation
Most people won't read them individually anyway, it's an easy way to find
them, and it's a lot of duplicated information if they are kept in two
different places.
2012-02-25 15:29:11 +01:00
Magnus Hagander da9ed7dafd Make each pg_stat_ view into it's own table in the documentation
This makes it easier to match a column name with the description of it,
and makes it possible to add more detailed documentation in the future.

This patch does not add that extra documentation at this point, only
the structure required for it.

Modeled on the changes already done to pg_stat_activity.
2012-02-25 15:20:49 +01:00
Peter Eisentraut 3aa42c25c3 Put Debian package list back in alphabetical order 2012-02-24 20:40:29 +02:00
Tom Lane b2ce60703a Last-minute release note updates.
Security: CVE-2012-0866, CVE-2012-0867, CVE-2012-0868
2012-02-23 17:47:52 -05:00
Tom Lane 891e6e7bfd Require execute permission on the trigger function for CREATE TRIGGER.
This check was overlooked when we added function execute permissions to the
system years ago.  For an ordinary trigger function it's not a big deal,
since trigger functions execute with the permissions of the table owner,
so they couldn't do anything the user issuing the CREATE TRIGGER couldn't
have done anyway.  However, if a trigger function is SECURITY DEFINER,
that is not the case.  The lack of checking would allow another user to
install it on his own table and then invoke it with, essentially, forged
input data; which the trigger function is unlikely to realize, so it might
do something undesirable, for instance insert false entries in an audit log
table.

Reported by Dinesh Kumar, patch by Robert Haas

Security: CVE-2012-0866
2012-02-23 15:38:56 -05:00
Robert Haas 2254367435 Make EXPLAIN (BUFFERS) track blocks dirtied, as well as those written.
Also expose the new counters through pg_stat_statements.

Patch by me.  Review by Fujii Masao and Greg Smith.
2012-02-22 20:33:05 -05:00
Bruce Momjian 4e6092a227 Improve wording of pg_upgrade logfile option:
-l, --logfile=FILENAME        log internal activity to file\n\
2012-02-22 18:40:32 -05:00
Tom Lane dd2954963b Draft release notes for 9.1.3, 9.0.7, 8.4.11, 8.3.18. 2012-02-22 18:12:25 -05:00
Peter Eisentraut a445cb92ef Add parameters for controlling locations of server-side SSL files
This allows changing the location of the files that were previously
hard-coded to server.crt, server.key, root.crt, root.crl.

server.crt and server.key continue to be the default settings and are
thus required to be present by default if SSL is enabled.  But the
settings for the server-side CA and CRL are now empty by default, and
if they are set, the files are required to be present.  This replaces
the previous behavior of ignoring the functionality if the files were
not found.
2012-02-22 23:40:46 +02:00
Andrew Dunstan 2f582f76b1 Improve pretty printing of viewdefs.
Some line feeds are added to target lists and from lists to make
them more readable. By default they wrap at 80 columns if possible,
but the wrap column is also selectable - if 0 it wraps after every
item.

Andrew Dunstan, reviewed by Hitoshi Harada.
2012-02-19 11:43:46 -05:00
Robert Haas 73a4b994a6 Make CREATE/ALTER FUNCTION support NOT LEAKPROOF.
Because it isn't good to be able to turn things on, and not off again.
2012-02-15 10:45:08 -05:00
Robert Haas d845fd684a sepgsql: Reword and fix typo in docs on DML permissions.
Per report from Christoph Berg.
2012-02-15 09:57:56 -05:00
Bruce Momjian 58d746213d Improve fsync documentation by stating that -W _0_ turns of write
caching.
2012-02-14 17:42:06 -05:00
Bruce Momjian c1d9df4fa2 Document random page cost is only 4x seqeuntial, and not 40x. 2012-02-14 16:54:54 -05:00
Bruce Momjian ef7a7c81d9 Document that the pg_test_fsync defaults allow the program to complete
in about 30 seconds.
2012-02-14 11:14:15 -05:00
Bruce Momjian 0a8396e35e Change contrib/pg_test_fsync to control tests in terms of seconds per
test, rather than a number of test cycles.  Changes -o/cycles option to
-s/seconds.
2012-02-14 11:10:03 -05:00
Robert Haas cd30728fb2 Allow LEAKPROOF functions for better performance of security views.
We don't normally allow quals to be pushed down into a view created
with the security_barrier option, but functions without side effects
are an exception: they're OK.  This allows much better performance in
common cases, such as when using an equality operator (that might
even be indexable).

There is an outstanding issue here with the CREATE FUNCTION / ALTER
FUNCTION syntax: there's no way to use ALTER FUNCTION to unset the
leakproof flag.  But I'm committing this as-is so that it doesn't
have to be rebased again; we can fix up the grammar in a future
commit.

KaiGai Kohei, with some wordsmithing by me.
2012-02-13 22:21:14 -05:00
Peter Eisentraut 169c8a9112 psql: Support zero byte field and record separators
Add new psql settings and command-line options to support setting the
field and record separators for unaligned output to a zero byte, for
easier interfacing with other shell tools.

reviewed by Abhijit Menon-Sen
2012-02-09 20:20:15 +02:00
Bruce Momjian a870c7fdbc Add opensp as a requirement for building the docs on Debian --- tested
on Debian Squeeze.
2012-02-07 20:30:11 -05:00
Robert Haas af7914c662 Add TIMING option to EXPLAIN, to allow eliminating of timing overhead.
Sometimes it may be useful to get actual row counts out of EXPLAIN
(ANALYZE) without paying the cost of timing every node entry/exit.
With this patch, you can say EXPLAIN (ANALYZE, TIMING OFF) to get that.

Tomas Vondra, reviewed by Eric Theise, with minor doc changes by me.
2012-02-07 11:23:04 -05:00
Peter Eisentraut a347f96b99 createuser: Disable prompting by default
Do not prompt when options were not specified.  Assume --no-createdb,
--no-createrole, --no-superuser by default.

Also disable prompting for user name in dropdb, unless --interactive
was specified.

reviewed by Josh Kupershmidt
2012-02-07 14:55:34 +02:00
Tom Lane 9bff0780cf Allow SQL-language functions to reference parameters by name.
Matthew Draper, reviewed by Hitoshi Harada
2012-02-04 19:23:49 -05:00
Bruce Momjian 072ba77bff Remove tabs in SGML file. 2012-02-04 07:11:44 -05:00
Andrew Dunstan 39909d1d39 Add array_to_json and row_to_json functions.
Also move the escape_json function from explain.c to json.c where it
seems to belong.

Andrew Dunstan, Reviewd by Abhijit Menon-Sen.
2012-02-03 12:11:16 -05:00
Peter Eisentraut 8a02339e9b initdb: Add options --auth-local and --auth-host
reviewed by Robert Haas and Pavel Stehule
2012-02-01 21:18:55 +02:00
Alvaro Herrera b2e431a4db Implement dry-run mode for pg_archivecleanup
In dry-run mode, just the name of the file to be removed is printed to
stdout; this is so the user can easily plug it into another program
through a pipe.  If debug mode is also specified, a more verbose message
is printed to stderr.

Author: Gabriele Bartolini
Reviewer: Josh Kupershmidt
2012-02-01 14:18:12 -03:00
Robert Haas 5384a73f98 Built-in JSON data type.
Like the XML data type, we simply store JSON data as text, after checking
that it is valid.  More complex operations such as canonicalization and
comparison may come later, but this is enough for not.

There are a few open issues here, such as whether we should attempt to
detect UTF-8 surrogate pairs represented as \uXXXX\uYYYY, but this gets
the basic framework in place.
2012-01-31 11:48:23 -05:00
Peter Eisentraut 82e83f46a2 Add sequence USAGE privileges to information schema
The sequence USAGE privilege is sufficiently similar to the SQL
standard that it seems reasonable to show in the information schema.
Also add some compatibility notes about it on the GRANT reference
page.
2012-01-30 21:45:42 +02:00
Peter Eisentraut ee7fa66b19 PL/Python: Add result metadata functions
Add result object functions .colnames, .coltypes, .coltypmods to
obtain information about the result column names and types, which was
previously not possible in the PL/Python SPI interface.

reviewed by Abhijit Menon-Sen
2012-01-30 21:38:52 +02:00
Tom Lane ed6e0545f5 Add caution about multiple unique indexes breaking plpgsql upsert example.
Per Phil Sorber, though I didn't use his wording exactly.
2012-01-28 21:06:41 -05:00
Tom Lane 17d3233e1b Update statement about sorting of character-string data.
The sort order is no longer fixed at database creation time, but can be
controlled via COLLATE.  Noted by Thomas Kellerer.
2012-01-28 20:54:56 -05:00
Tom Lane e2fa76d80b Use parameterized paths to generate inner indexscans more flexibly.
This patch fixes the planner so that it can generate nestloop-with-
inner-indexscan plans even with one or more levels of joining between
the indexscan and the nestloop join that is supplying the parameter.
The executor was fixed to handle such cases some time ago, but the
planner was not ready.  This should improve our plans in many situations
where join ordering restrictions formerly forced complete table scans.

There is probably a fair amount of tuning work yet to be done, because
of various heuristics that have been added to limit the number of
parameterized paths considered.  However, we are not going to find out
what needs to be adjusted until the code gets some real-world use, so
it's time to get it in there where it can be tested easily.

Note API change for index AM amcostestimate functions.  I'm not aware of
any non-core index AMs, but if there are any, they will need minor
adjustments.
2012-01-27 19:26:38 -05:00
Robert Haas eb6af016fc Document that COUNT(*) might not need a seq scan any more.
Noted by Josh Kupershmidt.
2012-01-27 12:40:37 -05:00
Robert Haas db6de5b71e Document that analyzing an empty table doesn't update the statistics.
Per a suggestion from Sergey Konoplev
2012-01-27 12:14:23 -05:00
Heikki Linnakangas 59c67ecdd3 Fix copy-paste error in docs.
Dean Rasheed
2012-01-27 12:48:42 +02:00
Magnus Hagander c9f14bb4ac Fix wording, per Peter Geoghegan 2012-01-27 10:36:27 +01:00
Heikki Linnakangas 2e92b5872f Mention in the docs that bgwriter now sleeps longer when it has no work to do. 2012-01-27 09:17:37 +02:00
Heikki Linnakangas d4bad4e1e1 Fix sentence in docs: checkpoints are not done by bgwriter anymore. 2012-01-26 19:08:20 +02:00
Magnus Hagander 61cb8c5abb Add deadlock counter to pg_stat_database
Adds a counter that tracks number of deadlocks that occurred in
each database to pg_stat_database.

Magnus Hagander, reviewed by Jaime Casanova
2012-01-26 15:58:19 +01:00
Magnus Hagander bc3347484a Track temporary file count and size in pg_stat_database
Add counters for number and size of temporary files used
for spill-to-disk queries for each database to the
pg_stat_database view.

Tomas Vondra, review by Magnus Hagander
2012-01-26 14:41:19 +01:00
Simon Riggs 8366c7803e Allow pg_basebackup from standby node with safety checking.
Base backup follows recommended procedure, plus goes to great
lengths to ensure that partial page writes are avoided.

Jun Ishizuka and Fujii Masao, with minor modifications
2012-01-25 18:02:04 +00:00
Alvaro Herrera 74ab96a45e Add pg_trigger_depth() function
This reports the depth level of triggers currently in execution, or zero
if not called from inside a trigger.

No catversion bump in this patch, but you have to initdb if you want
access to the new function.

Author: Kevin Grittner
2012-01-25 13:22:54 -03:00
Simon Riggs 443b4821f1 Add new replication mode synchronous_commit = 'write'.
Replication occurs only to memory on standby, not to disk,
so provides additional performance if user wishes to
reduce durability level slightly. Adds concept of multiple
independent sync rep queues.

Fujii Masao and Simon Riggs
2012-01-24 20:22:37 +00:00
Simon Riggs b8a91d9d1c ALTER <thing> [IF EXISTS] ... allows silent DDL if required,
e.g. ALTER FOREIGN TABLE IF EXISTS foo RENAME TO bar

Pavel Stehule
2012-01-23 23:25:04 +00:00
Magnus Hagander 4993a49b7c Typo fix
Guillaume Lelarge
2012-01-22 22:34:28 +01:00
Magnus Hagander 356fddfa0f Get rid of itemizedlist inside table
This renders badly on the website, and in this particular case also
doesn't actually add anything to the readability...
2012-01-20 12:30:19 +01:00
Magnus Hagander a65023e7de Further doc cleanups from the pg_stat_activity changes
Fujii Masao
2012-01-20 12:23:26 +01:00
Robert Haas 6e3323d41d Triggered change notifications.
Kevin Grittner, reviewed (in earlier versions) by Álvaro Herrera
2012-01-19 23:15:15 -05:00
Robert Haas c8397bd6d9 Clarify that bgwriter no longer handles checkpoints.
Text by Peter Geoghegan.
2012-01-19 21:53:46 -05:00
Robert Haas cc53a1e7cc Add bitwise AND, OR, and NOT operators for macaddr data type.
Brendan Jurd, reviewed by Fujii Masao
2012-01-19 15:25:14 -05:00
Magnus Hagander 4f42b546fd Separate state from query string in pg_stat_activity
This separates the state (running/idle/idleintransaction etc) into
it's own field ("state"), and leaves the query field containing just
query text.

The query text will now mean "current query" when a query is running
and "last query" in other states. Accordingly,the field has been
renamed from current_query to query.

Since backwards compatibility was broken anyway to make that, the procpid
field has also been renamed to pid - along with the same field in
pg_stat_replication for consistency.

Scott Mead and Magnus Hagander, review work from Greg Smith
2012-01-19 14:19:20 +01:00
Heikki Linnakangas fa352d662e Make pg_relation_size() and friends return NULL if the object doesn't exist.
That avoids errors when the functions are used in queries like "SELECT
pg_relation_size(oid) FROM pg_class", and a table is dropped concurrently.

Phil Sorber
2012-01-19 13:06:30 +02:00
Peter Eisentraut 6f6b46c9c0 PL/Python: Update example
Change the usesavedplan() example to use a more modern Python style
using the .setdefault() function.
2012-01-18 21:02:09 +02:00
Alvaro Herrera 3b11247aad Disallow merging ONLY constraints in children tables
When creating a child table, or when attaching an existing table as
child of another, we must not allow inheritable constraints to be
merged with non-inheritable ones, because then grandchildren would not
properly get the constraint.  This would violate the grandparent's
expectations.

Bugs noted by Robert Haas.

Author: Nikhil Sontakke
2012-01-16 19:27:05 -03:00
Magnus Hagander 0495aaad8b Allow a user to kill his own queries using pg_cancel_backend()
Allows a user to use pg_cancel_queries() to cancel queries in
other backends if they are running under the same role.
pg_terminate_backend() still requires superuser permissoins.

Short patch, many authors working on the bikeshed: Magnus Hagander,
Josh Kupershmidt, Edward Muller, Greg Smith.
2012-01-15 15:34:40 +01:00
Heikki Linnakangas 00c5f55061 Make superuser imply replication privilege. The idea of a privilege that
superuser doesn't have doesn't make much sense, as a superuser can do
whatever he wants through other means, anyway. So instead of granting
replication privilege to superusers in CREATE USER time by default, allow
replication connection from superusers whether or not they have the
replication privilege.

Patch by Noah Misch, per discussion on bug report #6264
2012-01-14 18:22:16 +02:00
Peter Eisentraut a9f2e31cf6 Support CREATE TABLE (LIKE ...) with foreign tables and views
Composite types are not yet supported, because parserOpenTable()
rejects them.
2012-01-10 21:46:29 +02:00
Peter Eisentraut 743ed082ac Add compatibility note about grant options on GRANT reference page
Point out in the compatibility section that granting grant options to
PUBLIC is not supported by PostgreSQL.  This is already mentioned
earlier, but since it concerns the information schema, it might be
worth pointing out explicitly as a compatibility issue.
2012-01-09 21:10:50 +02:00
Peter Eisentraut db49517c62 Rename the internal structures of the CREATE TABLE (LIKE ...) facility
The original implementation of this interpreted it as a kind of
"inheritance" facility and named all the internal structures
accordingly.  This turned out to be very confusing, because it has
nothing to do with the INHERITS feature.  So rename all the internal
parser infrastructure, update the comments, adjust the error messages,
and split up the regression tests.
2012-01-07 23:02:33 +02:00
Tom Lane 7a72efda72 Fix typo, pg_types_date.h => pgtypes_date.h.
Spotted by Koizumi Satoru.
2012-01-06 13:31:37 -05:00
Peter Eisentraut 104e7dac28 Improve ALTER DOMAIN / DROP CONSTRAINT with nonexistent constraint
ALTER DOMAIN / DROP CONSTRAINT on a nonexistent constraint name did
not report any error.  Now it reports an error.  The IF EXISTS option
was added to get the usual behavior of ignoring nonexistent objects to
drop.
2012-01-05 19:48:55 +02:00
Andrew Dunstan 63876d3bac Support for building with MS Visual Studio 2010.
Brar Piening, reviewed by Craig Ringer.
2012-01-03 08:44:26 -05:00
Bruce Momjian e126958c2e Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
Simon Riggs 64233902d2 Send new protocol keepalive messages to standby servers.
Allows streaming replication users to calculate transfer latency
and apply delay via internal functions. No external functions yet.
2011-12-31 13:30:26 +00:00
Alvaro Herrera 7db101c36e Minor enhancements to MVCC chapter
Author: Erik Rijkers
2011-12-26 19:09:50 -03:00
Tom Lane 472d3935a2 Rethink representation of index clauses' mapping to index columns.
In commit e2c2c2e8b1 I made use of nested
list structures to show which clauses went with which index columns, but
on reflection that's a data structure that only an old-line Lisp hacker
could love.  Worse, it adds unnecessary complication to the many places
that don't much care which clauses go with which index columns.  Revert
to the previous arrangement of flat lists of clauses, and instead add a
parallel integer list of column numbers.  The places that care about the
pairing can chase both lists with forboth(), while the places that don't
care just examine one list the same as before.

The only real downside to this is that there are now two more lists that
need to be passed to amcostestimate functions in case they care about
column matching (which btcostestimate does, so not passing the info is not
an option).  Rather than deal with 11-argument amcostestimate functions,
pass just the IndexPath and expect the functions to extract fields from it.
That gets us down to 7 arguments which is better than 11, and it seems
more future-proof against likely additions to the information we keep
about an index path.
2011-12-24 19:03:21 -05:00
Robert Haas d5448c7d31 Add bytea_agg, parallel to string_agg.
Pavel Stehule
2011-12-23 08:40:25 -05:00
Robert Haas 0510b62d91 Typo fixes.
All noted by Jaime Casanova.
2011-12-22 17:57:17 -05:00
Robert Haas 0e4611c023 Add a security_barrier option for views.
When a view is marked as a security barrier, it will not be pulled up
into the containing query, and no quals will be pushed down into it,
so that no function or operator chosen by the user can be applied to
rows not exposed by the view.  Views not configured with this
option cannot provide robust row-level security, but will perform far
better.

Patch by KaiGai Kohei; original problem report by Heikki Linnakangas
(in October 2009!).  Review (in earlier versions) by Noah Misch and
others.  Design advice by Tom Lane and myself.  Further review and
cleanup by me.
2011-12-22 16:16:31 -05:00
Peter Eisentraut f90dd28062 Add ALTER DOMAIN ... RENAME
You could already rename domains using ALTER TYPE, but with this new
command it is more consistent with how other commands treat domains as
a subcategory of types.
2011-12-22 22:43:56 +02:00
Robert Haas e1042a3484 sepgsql: Check CREATE permissions for some object types.
KaiGai Kohei, reviewed by Dimitri Fontaine and me.
2011-12-21 09:14:02 -05:00
Peter Eisentraut 729205571e Add support for privileges on types
This adds support for the more or less SQL-conforming USAGE privilege
on types and domains.  The intent is to be able restrict which users
can create dependencies on types, which restricts the way in which
owners can alter types.

reviewed by Yeb Havinga
2011-12-20 00:05:19 +02:00
Alvaro Herrera 61d81bd28d Allow CHECK constraints to be declared ONLY
This makes them enforceable only on the parent table, not on children
tables.  This is useful in various situations, per discussion involving
people bitten by the restrictive behavior introduced in 8.4.

Message-Id:
8762mp93iw.fsf@comcast.net
CAFaPBrSMMpubkGf4zcRL_YL-AERUbYF_-ZNNYfb3CVwwEqc9TQ@mail.gmail.com

Authors: Nikhil Sontakke, Alex Hunsaker
Reviewed by Robert Haas and myself
2011-12-19 17:30:23 -03:00
Tom Lane 9220362493 Teach SP-GiST to do index-only scans.
Operator classes can specify whether or not they support this; this
preserves the flexibility to use lossy representations within an index.

In passing, move constant data about a given index into the rd_amcache
cache area, instead of doing fresh lookups each time we start an index
operation.  This is mainly to try to make sure that spgcanreturn() has
insignificant cost; I still don't have any proof that it matters for
actual index accesses.  Also, get rid of useless copying of FmgrInfo
pointers; we can perfectly well use the relcache's versions in-place.
2011-12-19 14:58:41 -05:00
Tom Lane 3695a55513 Replace simple constant pg_am.amcanreturn with an AM support function.
The need for this was debated when we put in the index-only-scan feature,
but at the time we had no near-term expectation of having AMs that could
support such scans for only some indexes; so we kept it simple.  However,
the SP-GiST AM forces the issue, so let's fix it.

This patch only installs the new API; no behavior actually changes.
2011-12-18 15:50:37 -05:00
Bruce Momjian 153c8dbd8c Remove tabs in SGML file. 2011-12-18 08:32:58 -05:00
Tom Lane 8daeb5ddd6 Add SP-GiST (space-partitioned GiST) index access method.
SP-GiST is comparable to GiST in flexibility, but supports non-balanced
partitioned search structures rather than balanced trees.  As described at
PGCon 2011, this new indexing structure can beat GiST in both index build
time and query speed for search problems that it is well matched to.

There are a number of areas that could still use improvement, but at this
point the code seems committable.

Teodor Sigaev and Oleg Bartunov, with considerable revisions by Tom Lane
2011-12-17 16:42:30 -05:00
Andrew Dunstan 19fc0fe3ae Same clarification for pg_restore. 2011-12-17 13:12:01 -05:00
Andrew Dunstan 8900f663f2 Clarify the post-data status on unvalidated check constraints.
Per gripe from Thom Brown.
2011-12-17 12:38:40 -05:00
Andrew Dunstan a4cd6abcc9 Add --section option to pg_dump and pg_restore.
Valid values are --pre-data, data and post-data. The option can be
given more than once. --schema-only is equivalent to
--section=pre-data --section=post-data. --data-only is equivalent
to --section=data.

Andrew Dunstan, reviewed by Joachim Wieland and Josh Berkus.
2011-12-16 19:09:38 -05:00
Heikki Linnakangas 4b43b48c9f Fix reference to "verify-ca" and "verify-full" in a note in the docs. 2011-12-16 15:07:46 +02:00
Andrew Dunstan 6d09b2105f include_if_exists facility for config file.
This works the same as include, except that an error is not thrown
if the file is missing. Instead the fact that it's missing is
logged.

Greg Smith, reviewed by Euler Taveira de Oliveira.
2011-12-15 19:40:58 -05:00
Andrew Dunstan fb0eca0695 Fix docs build I inadvertantly broke. 2011-12-14 16:49:20 -05:00
Andrew Dunstan 7b070e896c Add --exclude-table-data option to pg_dump.
Andrew Dunstan, reviewed by Josh Berkus, Robert Haas and Peter Geoghegan.

This allows dumping of a table definition but not its data, on a per table basis.
Table name patterns are supported just as for --exclude-table.
2011-12-14 09:23:17 -05:00
Heikki Linnakangas 4adead1d22 Add support for passing cursor parameters in named notation in PL/pgSQL.
Yeb Havinga, reviewed by Kevin Grittner, with small changes by me.
2011-12-14 15:55:37 +02:00
Peter Eisentraut 5bcf8ede45 Add ALTER FOREIGN DATA WRAPPER / RENAME and ALTER SERVER / RENAME 2011-12-09 20:42:30 +02:00
Magnus Hagander 16d8e594ac Remove spclocation field from pg_tablespace
Instead, add a function pg_tablespace_location(oid) used to return
the same information, and do this by reading the symbolic link.

Doing it this way makes it possible to relocate a tablespace when the
database is down by simply changing the symbolic link.
2011-12-07 10:37:33 +01:00
Tom Lane c6e3ac11b6 Create a "sort support" interface API for faster sorting.
This patch creates an API whereby a btree index opclass can optionally
provide non-SQL-callable support functions for sorting.  In the initial
patch, we only use this to provide a directly-callable comparator function,
which can be invoked with a bit less overhead than the traditional
SQL-callable comparator.  While that should be of value in itself, the real
reason for doing this is to provide a datatype-extensible framework for
more aggressive optimizations, as in Peter Geoghegan's recent work.

Robert Haas and Tom Lane
2011-12-07 00:19:39 -05:00
Robert Haas 68281e0054 Make command-line tools smarter about finding a DB to connect to.
If unable to connect to "postgres", try "template1".  This allows things to
work more smoothly in the case where the postgres database has been
dropped.  And just in case that's not good enough, also allow the user to
specify a maintenance database to be used for the initial connection, to
cover the case where neither postgres nor template1 is suitable.
2011-12-06 08:48:15 -05:00
Magnus Hagander 6ef4ae1d4e Add missing documentation for function pg_stat_get_wal_senders()
Euler Taveira de Oliveira
2011-12-06 11:02:02 +01:00
Bruce Momjian 0e8f6bf0e7 In pg_upgrade, allow tables using regclass to be upgraded because we
preserve pg_class oids since PG 9.0.
2011-12-05 16:45:19 -05:00
Peter Eisentraut 89e850e6fd plpython: Add SPI cursor support
Add a function plpy.cursor that is similar to plpy.execute but uses an
SPI cursor to avoid fetching the entire result set into memory.

Jan Urbański, reviewed by Steve Singer
2011-12-05 19:52:15 +02:00
Andrew Dunstan e6d9e2106f Add a \setenv command to psql.
This can be used to set (or unset) environment variables that will
affect programs called by psql (such as the PAGER), probably most
usefully in a .psqlrc file.

Andrew Dunstan, reviewed by Josh Kupershmidt.
2011-12-04 11:43:38 -05:00
Magnus Hagander eb06416ba4 Remove incorrect instructions to run CREATE FOREIGN DATA WRAPPER
The CREATE EXTENSION step does this automatically. Doing it again will
cause an error.
2011-12-04 16:59:24 +01:00
Bruce Momjian 155e56bd97 Update documentation suggestions for debugging the backend.
Tom Lane, with minor adjustments by me.
2011-12-02 17:09:56 -05:00
Tom Lane 0de93a9c69 Add some weasel wording about threaded usage of PGresults.
PGresults used to be read-only from the application's viewpoint, but now
that we've exposed various functions that allow modification of a PGresult,
that sweeping statement is no longer accurate.  Noted by Dmitriy Igrishin.
2011-12-02 11:33:53 -05:00
Tom Lane 15a5006aac Clarify documentation about SQL:2008 variant of LIMIT/OFFSET syntax.
The point that you need parentheses for non-constant expressions apparently
needs to be brought out a bit more clearly, per bug #6315.
2011-12-01 16:38:59 -05:00
Bruce Momjian 1be6f93792 Add file-fdw documentation example.
Josh Berkus
2011-12-01 09:33:59 -05:00
Bruce Momjian ebbcba75b4 Add documentation mention that 7 != NULL also returns NULL. 2011-12-01 09:17:51 -05:00
Tom Lane bc9306f4c5 Update information about configuring SysV IPC parameters on NetBSD.
Per Emmanuel Kasper, sysctl works fine as of NetBSD 5.0.
2011-11-30 20:55:00 -05:00
Tom Lane 56d609c3b1 Draft release notes for 9.1.2, 9.0.6, 8.4.10, 8.3.17, 8.2.23. 2011-11-30 19:34:47 -05:00
Bruce Momjian 99f5e47df5 Change installation docs to mention general debugging options. 2011-11-29 22:35:48 -05:00
Bruce Momjian 2ff36abeec In docs, suggest "-O0 -g" only if using a debugger. 2011-11-29 19:12:38 -05:00
Bruce Momjian b60f37bf44 Suggest configure options for server developers.
Greg Smith
2011-11-29 16:32:38 -05:00
Tom Lane 5943d40168 Remove erroneous claim about use of pg_locks.objid for advisory locks.
The correct information appears in the text, so just remove the statement
in the table, where it did not fit nicely anyway.  (Curiously, the correct
info has been there much longer than the erroneous table entry.)
Resolves problem noted by Daniele Varrazzo.

In HEAD and 9.1, also do a bit of wordsmithing on other text on the page.
2011-11-28 13:51:58 -05:00
Magnus Hagander 64aea1ebc7 Add libpq connection option to disable SSL compression
This can be used to remove the overhead of SSL compression on
fast networks.

Laurenz Albe
2011-11-28 13:13:42 +01:00
Tom Lane 9ed439a9c0 Fix unsupported options in CREATE TABLE ... AS EXECUTE.
The WITH [NO] DATA option was not supported, nor the ability to specify
replacement column names; the former limitation wasn't even documented, as
per recent complaint from Naoya Anzai.  Fix by moving the responsibility
for supporting these options into the executor.  It actually takes less
code this way ...

catversion bump due to change in representation of IntoClause, which might
affect stored rules.
2011-11-24 23:21:45 -05:00
Tom Lane 604d4c4c95 Some more editing of the range-types documentation.
Be more thorough about specifying the expectations for canonical and
subtype_diff functions, and move that info to the same place.
2011-11-23 19:13:56 -05:00
Tom Lane 74c1723fc8 Remove user-selectable ANALYZE option for range types.
It's not clear that a per-datatype typanalyze function would be any more
useful than a generic typanalyze for ranges.  What *is* clear is that
letting unprivileged users select typanalyze functions is a crash risk or
worse.  So remove the option from CREATE TYPE AS RANGE, and instead put in
a generic typanalyze function for ranges.  The generic function does
nothing as yet, but hopefully we'll improve that before 9.2 release.
2011-11-23 00:03:22 -05:00
Tom Lane df73584431 Remove zero- and one-argument range constructor functions.
Per discussion, the zero-argument forms aren't really worth the catalog
space (just write 'empty' instead).  The one-argument forms have some use,
but they also have a serious problem with looking too much like functional
cast notation; to the point where in many real use-cases, the parser would
misinterpret what was wanted.

Committing this as a separate patch, with the thought that we might want
to revert part or all of it if we can think of some way around the cast
ambiguity.
2011-11-22 20:45:05 -05:00
Peter Eisentraut 024ea25ccd Small markup and wording improvement 2011-11-22 21:14:53 +02:00
Tom Lane b985d48779 Further code review for range types patch.
Fix some bugs in coercion logic and pg_dump; more comment cleanup;
minor cosmetic improvements.
2011-11-20 23:50:27 -05:00
Tom Lane a1a233af66 Further review of range-types patch.
Lots of documentation cleanup today, and still more type_sanity tests.
2011-11-18 18:24:32 -05:00
Tom Lane 1a8b9fb549 Extend the unknowns-are-same-as-known-inputs type resolution heuristic.
For a very long time, one of the parser's heuristics for resolving
ambiguous operator calls has been to assume that unknown-type literals are
of the same type as the other input (if it's known).  However, this was
only used in the first step of quickly checking for an exact-types match,
and thus did not help in resolving matches that require coercion, such as
matches to polymorphic operators.  As we add more polymorphic operators,
this becomes more of a problem.  This patch adds another use of the same
heuristic as a last-ditch check before failing to resolve an ambiguous
operator or function call.  In particular this will let us define the range
inclusion operator in a less limited way (to come in a follow-on patch).
2011-11-17 18:28:41 -05:00
Robert Haas 67dc4eed42 Remove ancient downcasing code from procedural language operations.
A very long time ago, language names were specified as literals rather
than identifiers, so this code was added to do case-folding.  But that
style has ben deprecated for many years so this isn't needed any more.
Language names will still be downcased when specified as unquoted
identifiers, but quoted identifiers or the old style using string
literals will be left as-is.
2011-11-17 14:25:18 -05:00
Tom Lane 4f9e33063c Return NULL instead of throwing error when desired bound is not available.
Change range_lower and range_upper to return NULL rather than throwing an
error when the input range is empty or the relevant bound is infinite.  Per
discussion, throwing an error seems likely to be unduly hard to work with.
Also, this is more consistent with the behavior of the constructors, which
treat NULL as meaning an infinite bound.
2011-11-14 15:34:39 -05:00
Tom Lane 851c83fc81 Return FALSE instead of throwing error for comparisons with empty ranges.
Change range_before, range_after, range_adjacent to return false rather
than throwing an error when one or both input ranges are empty.

The original definition is unnecessarily difficult to use, and also can
result in undesirable planner failures since the planner could try to
compare an empty range to something else while deriving statistical
estimates.  (This was, in fact, the cause of repeatable regression test
failures on buildfarm member jaguar, as well as intermittent failures
elsewhere.)

Also tweak rangetypes regression test to not drop all the objects it
creates, so that the final state of the regression database contains
some rangetype objects for pg_dump testing.
2011-11-14 15:15:53 -05:00
Peter Eisentraut 95d2af1646 Add psql expanded auto mode
This adds the "auto" option to the \x command, which switches to the
expanded mode when the normal output would be wider than the screen.

reviewed by Noah Misch
2011-11-12 17:03:10 +02:00
Robert Haas 788cb1c2e8 Correct documentation for trace_userlocks. 2011-11-10 18:00:34 -05:00
Robert Haas 71b2b657c0 Revert removal of trace_userlocks, because userlocks aren't gone.
This reverts commit 0180bd6180.
contrib/userlock is gone, but user-level locking still exists,
and is exposed via the pg_advisory* family of functions.
2011-11-10 17:54:27 -05:00
Bruce Momjian d5873b6359 Document that PQexec() can handle a NULL res pointer just fine.
Backpatch to 9.1.

Mark Hills
2011-11-10 13:00:44 -05:00
Heikki Linnakangas fbf99d2f16 Adjust range type docs for some last-minute changes I made to the patch.
non_empty(anyrange) function was removed, empty(anyrange) was renamed to
isempty(anyrange), and !? operators were removed.
2011-11-08 09:42:32 +02:00
Peter Eisentraut 6477d66780 -DLINUX_OOM_ADJ=0 should be in CPPFLAGS, not CFLAGS 2011-11-08 06:49:50 +02:00
Robert Haas b60653bc0b Remove hstore's text => text operator.
Since PostgreSQL 9.0, we've emitted a warning message when an operator
named => is created, because the SQL standard now reserves that token
for another use.  But we've also shipped such an operator with hstore.
Use of the function hstore(text, text) has been recommended in
preference to =>(text, text).  Per discussion, it's now time to take
the next step and stop shipping the operator.  This will allow us to
prohibit the use of => as an operator name in a future release if and
when we wish to support the SQL standard use of this token.

The release notes should mention this incompatibility.

Patch by me, reviewed by David Wheeler, Dimitri Fontaine and Tom Lane.
2011-11-07 21:47:45 -05:00
Robert Haas bd2396988a Minor grammar improvements. 2011-11-07 12:27:26 -05:00
Peter Eisentraut 27ef415a71 Fix archive_command example
The given archive_command example didn't use %p or %f, which wouldn't
really work in practice.
2011-11-04 22:01:35 +02:00
Peter Eisentraut 39b2d9ffb0 Add note about using GNU tar warning options for base backups 2011-11-04 21:52:37 +02:00
Andrew Dunstan f66c8252ab Role membership of superusers is only by explicit membership for HBA.
Document that this rule applies to 'samerole' as well as to named roles.

Per gripe from Tom Lane.
2011-11-03 16:29:41 -04:00
Andrew Dunstan 94cd0f1ad8 Do not treat a superuser as a member of every role for HBA purposes.
This makes it possible to use reject lines with group roles.

Andrew Dunstan, reviewd by Robert Haas.
2011-11-03 12:45:02 -04:00
Heikki Linnakangas 4429f6a9e3 Support range data types.
Selectivity estimation functions are missing for some range type operators,
which is a TODO.

Jeff Davis
2011-11-03 13:42:15 +02:00
Simon Riggs 4334289186 Improve docs for timing and skipping of checkpoints
Greg Smith
2011-11-03 08:52:20 +00:00
Magnus Hagander 589adb86ee Document that multiple LDAP servers can be specified 2011-11-01 15:44:26 +01:00
Robert Haas 9cf12dfd4e Clarify that ORDER BY/FOR UPDATE can't malfunction at higher iso levels.
Kevin Grittner
2011-10-28 12:02:04 -04:00
Robert Haas 6c21105fb4 Change "and and" to "and".
Report by Vik Reykja, patch by Kevin Grittner.
2011-10-28 11:59:55 -04:00
Tom Lane bf82013631 Typo fixes.
expect -> except, noted by Andrew Dunstan.  Also, "cannot" seems more
readable here than "can not", per David Wheeler.
2011-10-26 18:04:13 -04:00
Magnus Hagander d9bae53173 Implement streaming xlog for backup tools
Add option for parallel streaming of the transaction log while a
base backup is running, to get the logfiles before the server has
removed them.

Also add a tool called pg_receivexlog, which streams the transaction
log into files, creating a log archive without having to wait for
segments to complete, thus decreasing the window of data loss without
having to waste space using archive_timeout. This works best in
combination with archive_command - suggested usage docs etc coming later.
2011-10-26 20:13:33 +02:00
Magnus Hagander b0bec068e2 Fix typo 2011-10-25 22:46:14 +02:00
Magnus Hagander d8ea33f2c0 Support configurable eventlog application names on Windows
This allows different instances to use the eventlog with different
identifiers, by setting the event_source GUC, similar to how
syslog_ident works.

Original patch by MauMau, heavily modified by Magnus Hagander
2011-10-25 20:02:55 +02:00
Tom Lane bb446b689b Support synchronization of snapshots through an export/import procedure.
A transaction can export a snapshot with pg_export_snapshot(), and then
others can import it with SET TRANSACTION SNAPSHOT.  The data does not
leave the server so there are not security issues.  A snapshot can only
be imported while the exporting transaction is still running, and there
are some other restrictions.

I'm not totally convinced that we've covered all the bases for SSI (true
serializable) mode, but it works fine for lesser isolation modes.

Joachim Wieland, reviewed by Marko Tiikkaja, and rather heavily modified
by Tom Lane
2011-10-22 18:23:30 -04:00
Robert Haas 3716ab2c0c Document that postmaster.opts is excluded from base backups
Fujii Masao
2011-10-19 00:20:21 -04:00
Robert Haas c53d3a9ee1 Make the CHECKPOINT reference page more clear.
Josh Kupershmidt, reviewed by Fujii Masao
2011-10-18 20:14:51 -04:00
Tom Lane 336c1d7a51 Avoid assuming that index-only scan data matches the index's rowtype.
In general the data returned by an index-only scan should have the
datatypes originally computed by FormIndexDatum.  If the index opclasses
use "storage" datatypes different from their input datatypes, the scan
tuple will not have the same rowtype attributed to the index; but we had
a hard-wired assumption that that was true in nodeIndexonlyscan.c.  We'd
already hacked around the issue for the one case where the types are
different in btree indexes (btree name_ops), but this would definitely
come back to bite us if we ever implement index-only scans in GiST.

To fix, require the index AM to explicitly provide the tupdesc for the
tuple it is returning.  btree can just pass back the index's tupdesc, but
GiST will have to work harder when and if it supports index-only scans.

I had previously proposed fixing this by allowing the index AM to fill the
scan tuple slot directly; but on reflection that seemed like a module
layering violation, since TupleTableSlots are creatures of the executor.
At least in the btree case, it would also be less efficient, since the
tuple deconstruction work would occur even for rows later found to be
invisible to the scan's snapshot.
2011-10-16 19:15:04 -04:00
Tom Lane 9e8da0f757 Teach btree to handle ScalarArrayOpExpr quals natively.
This allows "indexedcol op ANY(ARRAY[...])" conditions to be used in plain
indexscans, and particularly in index-only scans.
2011-10-16 15:39:24 -04:00
Tom Lane 0898d71f66 Marginal improvements to documentation of plpgsql's OPEN cursor statement.
Rearrange text to improve clarity, and add an example of implicit reference
to a plpgsql variable in a bound cursor's query.  Byproduct of some work
I'd done on the "named cursor parameters" patch before giving up on it.
2011-10-15 13:02:37 -04:00
Bruce Momjian b4aec388d8 Document that is the psql version number, not the server version number,
that controls .psqlrc.
2011-10-15 11:43:19 -04:00
Bruce Momjian 2deba6d405 Improve doc wording of drop table permission. 2011-10-15 10:08:02 -04:00
Bruce Momjian 2795592e52 Allow a major PG version psql .psqlrc file to be used if a minor
matching version file does not exist.  This avoids needing to rename
.psqlrc files after minor version upgrades.
2011-10-14 20:27:14 -04:00
Tom Lane e6858e6657 Measure the number of all-visible pages for use in index-only scan costing.
Add a column pg_class.relallvisible to remember the number of pages that
were all-visible according to the visibility map as of the last VACUUM
(or ANALYZE, or some other operations that update pg_class.relpages).
Use relallvisible/relpages, instead of an arbitrary constant, to estimate
how many heap page fetches can be avoided during an index-only scan.

This is pretty primitive and will no doubt see refinements once we've
acquired more field experience with the index-only scan mechanism, but
it's way better than using a constant.

Note: I had to adjust an underspecified query in the window.sql regression
test, because it was changing answers when the plan changed to use an
index-only scan.  Some of the adjacent tests perhaps should be adjusted
as well, but I didn't do that here.
2011-10-14 17:23:46 -04:00
Bruce Momjian ad30d36642 Document actual string that has to be returned by the client for MD5
authentication.

Report and pseudo code by Cyan Ogilvie
2011-10-13 20:48:50 -04:00
Bruce Momjian 0180bd6180 Remove all "traces" of trace_userlocks, because userlocks were removed
in PG 8.2.
2011-10-13 19:59:57 -04:00
Bruce Momjian fb4340c5ea Update documentation about ts_rank(). 2011-10-13 14:17:20 -04:00
Bruce Momjian 12ff9fa771 Have pg_ctl return an exit status of 3 if the server is not running, to
match the Linux Standard Base Core Specification 3.1.

Aaron W. Swenson
2011-10-13 13:02:36 -04:00
Tom Lane de1bf53a25 Fix typo in dummy_seclabel documentation.
dummy_label -> dummy_seclabel

Thom Brown
2011-10-13 12:16:07 -04:00
Bruce Momjian cf72528e87 Document who can drop a table (owner and user with permissions). 2011-10-13 10:05:54 -04:00
Bruce Momjian 4c32f81766 Remove tab in sgml file. 2011-10-13 09:33:29 -04:00
Bruce Momjian e0b268fb82 Document how to accent Alvaro Herrera in the release notes. 2011-10-12 17:20:05 -04:00
Bruce Momjian f2b36d8e10 Clarify wording of foreign key documentation to mention null entries as
not matching the primary key.

Report from Marek.Balgar@seznam.cz
2011-10-12 16:58:39 -04:00
Tom Lane 458857cc9d Throw a useful error message if an extension script file is fed to psql.
We have seen one too many reports of people trying to use 9.1 extension
files in the old-fashioned way of sourcing them in psql.  Not only does
that usually not work (due to failure to substitute for MODULE_PATHNAME
and/or @extschema@), but if it did work they'd get a collection of loose
objects not an extension.  To prevent this, insert an \echo ... \quit
line that prints a suitable error message into each extension script file,
and teach commands/extension.c to ignore lines starting with \echo.
That should not only prevent any adverse consequences of loading a script
file the wrong way, but make it crystal clear to users that they need to
do it differently now.

Tom Lane, following an idea of Andrew Dunstan's.  Back-patch into 9.1
... there is not going to be much value in this if we wait till 9.2.
2011-10-12 15:45:03 -04:00
Bruce Momjian e0d273500a Modify up/home macro to match standard parameter list; fixes doc build. 2011-10-12 14:05:37 -04:00
Tom Lane 80c6409c2b Improve documentation of psql's \q command.
The documentation neglected to explain its behavior in a script file
(it only ends execution of the script, not psql as a whole), and failed
to mention the long form \quit either.
2011-10-12 13:59:30 -04:00
Bruce Momjian b8691d838b Add Up/Home link to the top of the HTML doc output.
Backpatch to 9.0.X and 9.1.X.
2011-10-12 11:24:51 -04:00
Bruce Momjian 47cacfc0f1 Document that not backing up postmaster.pid and postmaster.opts might
help prevent pg_ctl from getting confused.

Backpatch to 9.1.
2011-10-11 17:33:20 -04:00
Robert Haas 5b9102cef2 Make the reference to "CREATE USER" in the CREATE ROLE page a link.
This might help to avoid confusion between the CREATE USER command,
and the deprecated CREATEUSER option to CREATE ROLE, as per a recent
complaint from Ron Adams.  At any rate, having a cross-link here
seems like a good idea; two commands that are so similar should
reference each other.
2011-10-10 13:38:32 -04:00
Robert Haas e8bb5f7245 Improve documentation of how to fiddle with SCSI drives on FreeBSD.
Per suggestions from Achilleas Mantzios and Greg Smith.
2011-10-10 13:21:35 -04:00
Robert Haas 322019ed2e Fix typo in docs for libpq keepalives_count option.
Shigehiro Honda
2011-10-10 13:10:47 -04:00
Robert Haas 48a62278ed Add doc index entry for pg_resetxlog.
Fujii Masao
2011-10-10 13:05:25 -04:00
Robert Haas 61dd737c29 Document DELETE/UPDATE command tag behavior when triggers are involved.
Marti Raudsepp
2011-10-10 12:53:04 -04:00
Robert Haas 0ff7ea5d3c Some minor wordsmithing for the cascading replication documentation.
Per report from Thom Brown.
2011-10-10 10:16:28 -04:00
Bruce Momjian 0dc3f57ba0 In pg_upgrade, add -o/-O options to pass parameters to the servers, and
document its use for config-only directory installs.
2011-10-10 07:44:11 -04:00
Tom Lane cbfa92c23c Improve index-only scans to avoid repeated access to the index page.
We copy all the matched tuples off the page during _bt_readpage, instead of
expensively re-locking the page during each subsequent tuple fetch.  This
costs a bit more local storage, but not more than 2*BLCKSZ worth, and the
reduction in LWLock traffic is certainly worth that.  What's more, this
lets us get rid of the API wart in the original patch that said an index AM
could randomly decline to supply an index tuple despite having asserted
pg_am.amcanreturn.  That will be important for future improvements in the
index-only-scan feature, since the executor will now be able to rely on
having the index data available.
2011-10-09 00:21:08 -04:00
Tom Lane c78d8cd146 Note that index-only scans can affect idx_tup_fetch.
An index-only scan that avoids heap fetches will increment idx_tup_read
but not idx_tup_fetch.
2011-10-08 11:09:18 -04:00
Robert Haas 13168ae4eb Add missing space.
Dickson S. Guedes
2011-10-07 23:48:38 -04:00
Tom Lane a2822fb933 Support index-only scans using the visibility map to avoid heap fetches.
When a btree index contains all columns required by the query, and the
visibility map shows that all tuples on a target heap page are
visible-to-all, we don't need to fetch that heap page.  This patch depends
on the previous patches that made the visibility map reliable.

There's a fair amount left to do here, notably trying to figure out a less
chintzy way of estimating the cost of an index-only scan, but the core
functionality seems ready to commit.

Robert Haas and Ibrar Ahmed, with some previous work by Heikki Linnakangas.
2011-10-07 20:14:13 -04:00
Bruce Momjian 981e5acd24 Move pg_upgrade doc mention of the port numbers to the same place. 2011-10-06 19:31:20 -04:00
Bruce Momjian aaa6e1def2 Add postmaster -C option to query configuration parameters, and have
pg_ctl use that to query the data directory for config-only installs.
This fixes awkward or impossible pg_ctl operation for config-only
installs.
2011-10-06 09:38:39 -04:00
Bruce Momjian 3919ad864d Change wording for COALESCE docs to use "otherwise".
Per Tom
2011-10-04 22:39:29 -04:00
Bruce Momjian 9d23d7cdaf Explain COALESCE example in the docs. 2011-10-04 21:47:51 -04:00
Tom Lane 1a00c0ef53 Remove the custom_variable_classes parameter.
This variable provides only marginal error-prevention capability (since
it can only check the prefix of a qualified GUC name), and the consensus
is that that isn't worth the amount of hassle that maintaining the setting
creates for DBAs.  So, let's just remove it.

With this commit, the system will silently accept a value for any qualified
GUC name at all, whether it has anything to do with any known extension or
not.  (Unqualified names still have to match known built-in settings,
though; and you will get a WARNING at extension load time if there's an
unrecognized setting with that extension's prefix.)

There's still some discussion ongoing about whether to tighten that up and
if so how; but if we do come up with a solution, it's not likely to look
anything like custom_variable_classes.
2011-10-04 12:36:55 -04:00
Tom Lane d56b3afc03 Restructure error handling in reading of postgresql.conf.
This patch has two distinct purposes: to report multiple problems in
postgresql.conf rather than always bailing out after the first one,
and to change the policy for whether changes are applied when there are
unrelated errors in postgresql.conf.

Formerly the policy was to apply no changes if any errors could be
detected, but that had a significant consistency problem, because in some
cases specific values might be seen as valid by some processes but invalid
by others.  This meant that the latter processes would fail to adopt
changes in other parameters even though the former processes had done so.

The new policy is that during SIGHUP, the file is rejected as a whole
if there are any errors in the "name = value" syntax, or if any lines
attempt to set nonexistent built-in parameters, or if any lines attempt
to set custom parameters whose prefix is not listed in (the new value of)
custom_variable_classes.  These tests should always give the same results
in all processes, and provide what seems a reasonably robust defense
against loading values from badly corrupted config files.  If these tests
pass, all processes will apply all settings that they individually see as
good, ignoring (but logging) any they don't.

In addition, the postmaster does not abandon reading a configuration file
after the first syntax error, but continues to read the file and report
syntax errors (up to a maximum of 100 syntax errors per file).

The postmaster will still refuse to start up if the configuration file
contains any errors at startup time, but these changes allow multiple
errors to be detected and reported before quitting.

Alexey Klyukin, reviewed by Andy Colson and av (Alexander ?)
with some additional hacking by Tom Lane
2011-10-02 16:50:04 -04:00
Tom Lane 5ec6b7f1b8 Improve generated column names for cases involving sub-SELECTs.
We'll now use "exists" for EXISTS(SELECT ...), "array" for ARRAY(SELECT
...), or the sub-select's own result column name for a simple expression
sub-select.  Previously, you usually got "?column?" in such cases.

Marti Raudsepp, reviewed by Kyotaro Horiugchi
2011-10-01 14:01:46 -04:00
Tom Lane d22a09dc70 Support GiST index support functions that want to cache data across calls.
pg_trgm was already doing this unofficially, but the implementation hadn't
been thought through very well and leaked memory.  Restructure the core
GiST code so that it actually works, and document it.  Ordinarily this
would have required an extra memory context creation/destruction for each
GiST index search, but I was able to avoid that in the normal case of a
non-rescanned search by finessing the handling of the RBTree.  It used to
have its own context always, but now shares a context with the
scan-lifespan data structures, unless there is more than one rescan call.
This should make the added overhead unnoticeable in typical cases.
2011-09-30 19:48:57 -04:00
Tom Lane a32dd16459 Update and extend the EXPLAIN-related documentation.
I've made a significant effort at filling in the "Using EXPLAIN" section
to be reasonably complete about mentioning everything that EXPLAIN can
output, including the "Rows Removed" outputs that were added by Marko
Tiikkaja's recent documentation-free patch.  I also updated the examples to
be consistent with current behavior; several of them were not close to what
the current code will do.  No doubt there's more that can be done here, but
I'm out of patience for today.
2011-09-28 19:39:54 -04:00
Tom Lane cc4ff8742b Take sepgsql regression tests out of the regular regression test mechanism.
Because these tests require root privileges, not to mention invasive
changes to the security configuration of the host system, it's not
reasonable for them to be invoked by a regular "make check" or "make
installcheck".  Instead, dike out the Makefile's knowledge of the tests,
and change chkselinuxenv (now renamed "test_sepgsql") into a script that
verifies the environment is workable and then runs the tests.  It's
expected that test_sepgsql will only be run manually.

While at it, do some cleanup in the error checking in the script, and
do some wordsmithing in the documentation.
2011-09-27 20:07:15 -04:00
Tom Lane 2a571bc233 Fully const-ify PQconnectdbParams, PQconnectStartParams, and PQpingParams.
The keywords and values arguments of these functions are more properly
declared "const char * const *" than just "const char **".

Lionel Elie Mamane, reviewed by Craig Ringer
2011-09-25 18:52:48 -04:00
Magnus Hagander 0126db2a46 Fix typo 2011-09-24 14:34:32 +02:00
Magnus Hagander 33e81fdfaf Note that sslmode=require verifies the CA if root cert is present
This mode still exists for backwards compatibility, making
sslmode=require the same as sslmode=verify-ca when the file is present,
but not causing an error when it isn't.

Per bug 6189, reported by Srinivas Aji
2011-09-24 14:25:12 +02:00
Robert Haas a5e94ea52b Document some more apparently-harmless error messages. 2011-09-23 17:02:46 -04:00
Robert Haas b056b716e2 Add --{no-,}replication flags to createuser.
Fujii Masao, reviewed by Cédric Villemain, with some doc changes by me.
2011-09-23 09:25:20 -04:00
Simon Riggs e5e2f7b054 synchronous_commit is an enum not a boolean.
Jaime Casanova
2011-09-23 08:35:33 +01:00
Tom Lane 614421f9aa Update release notes for 9.1.1, 9.0.5, 8.4.9, 8.3.16, 8.2.22.
Man, we fixed a lotta bugs since April.
2011-09-22 17:39:05 -04:00
Tom Lane 86a3f2d492 Add FORCE_NOT_NULL support to the file_fdw foreign data wrapper.
This is implemented as a per-column boolean option, rather than trying
to match COPY's convention of a single option listing the column names.

Shigeru Hanada, reviewed by KaiGai Kohei
2011-09-16 16:35:51 -04:00
Tom Lane e6faf910d7 Redesign the plancache mechanism for more flexibility and efficiency.
Rewrite plancache.c so that a "cached plan" (which is rather a misnomer
at this point) can support generation of custom, parameter-value-dependent
plans, and can make an intelligent choice between using custom plans and
the traditional generic-plan approach.  The specific choice algorithm
implemented here can probably be improved in future, but this commit is
all about getting the mechanism in place, not the policy.

In addition, restructure the API to greatly reduce the amount of extraneous
data copying needed.  The main compromise needed to make that possible was
to split the initial creation of a CachedPlanSource into two steps.  It's
worth noting in particular that SPI_saveplan is now deprecated in favor of
SPI_keepplan, which accomplishes the same end result with zero data
copying, and no need to then spend even more cycles throwing away the
original SPIPlan.  The risk of long-term memory leaks while manipulating
SPIPlans has also been greatly reduced.  Most of this improvement is based
on use of the recently-added MemoryContextSetParent primitive.
2011-09-16 00:43:52 -04:00
Heikki Linnakangas 76df369c06 In the manual section on primary_conninfo, recommend using a role with
REPLICATION privileges, not SUPERUSER.

Fujii Masao
2011-09-14 09:30:32 +03:00
Bruce Momjian d68ccf536e Remove double-quoting of table names in clusterdb. BACKWARD COMPABILITY
BREAKAGE.

Remove double-quoting of index/table names in reindexdb.  BACKWARD
COMPABILITY BREAKAGE.

Document thate user/database names are preserved with double-quoting by
command-line tools like vacuumdb.
2011-09-10 16:39:02 -04:00
Bruce Momjian 90108c9aab Document that only user-defined columns are expanded by SELECT *. 2011-09-10 10:45:55 -04:00
Bruce Momjian c79003ea4f Remove unnecessary MATCH FULL specification in example.
Reported by Grzegorz Szpetkowski.
2011-09-10 09:24:46 -04:00
Tom Lane ca4af308c3 Simplify handling of the timezone GUC by making initdb choose the default.
We were doing some amazingly complicated things in order to avoid running
the very expensive identify_system_timezone() procedure during GUC
initialization.  But there is an obvious fix for that, which is to do it
once during initdb and have initdb install the system-specific default into
postgresql.conf, as it already does for most other GUC variables that need
system-environment-dependent defaults.  This means that the timezone (and
log_timezone) settings no longer have any magic behavior in the server.
Per discussion.
2011-09-09 17:59:11 -04:00
Tom Lane a7801b62f2 Move Timestamp/Interval typedefs and basic macros into datatype/timestamp.h.
As per my recent proposal, this refactors things so that these typedefs and
macros are available in a header that can be included in frontend-ish code.
I also changed various headers that were undesirably including
utils/timestamp.h to include datatype/timestamp.h instead.  Unsurprisingly,
this showed that half the system was getting utils/timestamp.h by way of
xlog.h.

No actual code changes here, just header refactoring.
2011-09-09 13:23:41 -04:00
Heikki Linnakangas 86ab71d58d Fix typo and reword the sentence. 2011-09-08 18:17:57 +03:00
Heikki Linnakangas 5edb24a898 Buffering GiST index build algorithm.
When building a GiST index that doesn't fit in cache, buffers are attached
to some internal nodes in the index. This speeds up the build by avoiding
random I/O that would otherwise be needed to traverse all the way down the
tree to the find right leaf page for tuple.

Alexander Korotkov
2011-09-08 17:51:23 +03:00
Tom Lane 09b68c70af One last round of copy-editing for the 9.1 release notes.
Also set the documented release date to 2011-09-12.
2011-09-08 00:53:11 -04:00
Bruce Momjian 3ced32d24e In pg_upgrade, disallow migration of 8.3 clusters using contrib/ltree
because its internal format was changed in 8.4.

Backpatch to 9.0 and 9.1.

Report by depesz, diagnosis by Tom.
2011-09-07 14:43:12 -04:00
Bruce Momjian 029dfdf115 Fix to_date() and to_timestamp() to handle year masks of length < 4 so
they wrap toward year 2020, rather than the inconsistent behavior we had
before.
2011-09-07 09:47:51 -04:00
Bruce Momjian 8eacb25cbe Revert documentation patch about NEW/OLD and triggers.
Backpatch to 9.0 and 9.1.

Patch from Josh Kupershmidt.
2011-09-07 09:24:34 -04:00
Bruce Momjian 39039e6d7a Properly document the existance of OLD/NEW trigger pl/pgsql trigger
fields.

Backpatch to 9.0 and 9.1.

Report from Pavel Stehule, patch from Josh Kupershmidt
2011-09-06 22:54:16 -04:00
Bruce Momjian d858abfdfd Fix spelling mistake in pgpass documentation change.
Per Peter.
2011-09-06 19:42:46 -04:00
Bruce Momjian a25fc9edcb Add documentation suggestion about adding a comment to the top of
pgpass.

Backpatch to 9.1.
2011-09-06 17:32:53 -04:00
Bruce Momjian ba3de10c4e Fix plpgsql "PERFORM" markup.
Backpatch to 9.0 and 9.1.
2011-09-06 15:20:59 -04:00
Bruce Momjian 6f94280dee Document PERFORM limitation when using WITH queries.
Backpatch to 9.0 and 9.1.

Report from depstein@alliedtesting.com.
2011-09-06 13:42:08 -04:00
Tom Lane ae92eff6b9 Add an "incompatibility" entry to 9.1 release notes about CREATE EXTENSION.
We've now seen more than one gripe from somebody who didn't get the memo
about how to install contrib modules in 9.1.  Try to make it a little more
prominent that you aren't supposed to call the scripts directly anymore.
2011-09-06 12:36:40 -04:00
Tom Lane b7f83e70d9 Update type-conversion documentation for long-ago changes.
This example wasn't updated when we changed the behavior of bpcharlen()
in 8.0, nor when we changed the number of parameters taken by the bpchar()
cast function in 7.3.  Per report from lsliang.
2011-09-06 12:14:51 -04:00
Bruce Momjian d764835bbc Properly document semphore requirements by accounting for worker
processes.

Backpatch to 9.1 and 9.0.

Submitted by Anton Yuzhaninov, confirmed by Robert Haas
2011-09-06 11:08:32 -04:00
Bruce Momjian 5c8676ea71 Add documentation link to strftime supported options. 2011-09-05 22:58:10 -04:00
Bruce Momjian 7cb99b2696 Add mention that UTC really means UT1.
Backpatch to 9.1.
2011-09-05 15:38:37 -04:00
Bruce Momjian d235f828d7 Document that contrib/pgtrgm only processes ASCII alphanumeric
characters.

Backpatch to 9.0 and 9.1.
2011-09-05 13:24:45 -04:00
Robert Haas 4232c4b406 Userspace access vector cache for contrib/sepgsql.
KaiGai Kohei
2011-09-01 08:38:40 -04:00
Heikki Linnakangas 5cfe33fe7b The replication status values in pg_stat_replication was changed to
lowercase earlier, but documentation was not updated. Update the docs.

Fujii Masao
2011-08-31 12:37:37 +03:00
Peter Eisentraut aeabbccea0 Some markup cleanup to deconfuse the find_gt_lt tool
Josh Kupershmidt
2011-08-30 20:32:49 +03:00
Robert Haas 083549e43a Repair brain fade in previous commit, per Josh Kupershmidt. 2011-08-30 12:49:18 -04:00
Robert Haas 7fe33a51b9 Add --if-exists option to dropdb and dropuser.
Josh Kupershmidt, with some further editing by me.
2011-08-30 12:14:39 -04:00
Peter Eisentraut f44d275b6d Document minimum required version of DocBook XSL stylesheets 2011-08-27 23:28:55 +03:00
Peter Eisentraut fd5b397ca4 Implement the information schema with_hierarchy column
In PostgreSQL, this is included in the SELECT privilege, so show YES
or NO depending on whether SELECT is granted.
2011-08-27 15:03:02 +03:00
Peter Eisentraut 3104cc89be Spelling improvement 2011-08-27 08:08:26 +03:00
Tom Lane 928311a463 Clean up weird corner cases in lexing of psql meta-command arguments.
These changes allow backtick command evaluation and psql variable
interpolation to happen on substrings of a single meta-command argument.
Formerly, no such evaluations happened at all if the backtick or colon
wasn't the first character of the argument, and we considered an argument
completed as soon as we'd processed one backtick, variable reference, or
quoted substring.  A string like 'FOO'BAR was thus taken as two arguments
not one, not exactly what one would expect.  In the new coding, an argument
is considered terminated only by unquoted whitespace or backslash.

Also, clean up a bunch of omissions, infelicities and outright errors in
the psql documentation of variables and metacommand argument syntax.
2011-08-26 13:53:11 -04:00
Tom Lane e86fdb0ab2 Support non-ASCII letters in psql variable names.
As in the backend, the implementation actually accepts any non-ASCII
character, but we only document that you can use letters.
2011-08-26 13:53:09 -04:00
Robert Haas 6fc726adac Adjust CREATE DOMAIN example for standard_conforming_strings=on.
Noted by Hitoshi Harada.
2011-08-25 09:37:44 -04:00
Tom Lane d1d388603e Fix pgxs.mk to always add --dbname=$(CONTRIB_TESTDB) to REGRESS_OPTS.
The previous coding resulted in contrib modules unintentionally overriding
the use of CONTRIB_TESTDB.  There seems no particularly good reason to
allow that (after all, the makefile can set CONTRIB_TESTDB if that's really
what it intends).

In passing, document REGRESS_OPTS where the other pgxs.mk options are
documented.

Back-patch to 9.1 --- in prior versions, there were no cases of contrib
modules setting REGRESS_OPTS without including the --dbname switch, so
while the coding was fragile there was no actual bug.
2011-08-24 15:16:50 -04:00
Heikki Linnakangas 6c6a415333 Add recovery.conf to the index in the user manual.
Fujii Masao
2011-08-23 11:57:17 +03:00
Tom Lane 1a998474a7 Update 9.1 release notes to reflect commits through today.
Also do another pass of copy-editing.
2011-08-17 20:18:15 -04:00
Magnus Hagander e5cb756361 Adjust wording now that estimated size can increase
Per comment form Fujii Masao.
2011-08-17 11:01:06 +02:00
Peter Eisentraut 1368409034 MacOS -> Mac OS
Josh Kupershmidt
2011-08-17 10:05:22 +03:00
Peter Eisentraut 7431cb251a Fix typo 2011-08-14 10:40:50 +03:00
Bruce Momjian eb72adc82e Add major features list and introductory text for 9.1 release notes.
Backpatch to 9.1, obviously.
2011-08-11 16:36:56 -04:00
Robert Haas d82d84864c Display both per-table and per-column FDW options in psql's \d output.
Along the way, rename "Options" to "FDW Options" in various places for
consistency and clarity.

Shigeru Hanada
2011-08-11 11:45:47 -04:00
Robert Haas 59414cdedb Change psql's \dd command to do something more useful.
Instead of displaying comments on an arbitrary subset of the object
types which support them, make \dd display comments on exactly those
object types which don't have their own backlash commands.  We now
regard the display of comments as properly the job of the relevant
backslash command (though many of them do so only in verbose mode)
rather than something that \dd should be responsible for.  However,
a handful of object types have no backlash command, so make \dd
give information about those.

Josh Kupershmidt
2011-08-11 11:16:29 -04:00
Tom Lane cff75130b5 Remove wal_sender_delay GUC, because it's no longer useful.
The latch infrastructure is now capable of detecting all cases where the
walsender loop needs to wake up, so there is no reason to have an arbitrary
timeout.

Also, modify the walsender loop logic to follow the standard pattern of
ResetLatch, test for work to do, WaitLatch.  The previous coding was both
hard to follow and buggy: it would sometimes busy-loop despite having
nothing available to do, eg between receipt of a signal and the next time
it was caught up with new WAL, and it also had interesting choices like
deciding to update to WALSNDSTATE_STREAMING on the strength of information
known to be obsolete.
2011-08-10 18:50:28 -04:00
Robert Haas d82a9d2a60 Teach psql to display the comments on SQL/MED objects in verbose mode.
The relevant backslash commands already exist, so we're just adding an
additional column.  With this commit, all objects that have psql backslash
commands and accept comments should now display those comments at least
in verbose mode.

Josh Kupershmidt, with doc additions by me.
2011-08-08 16:30:39 -04:00
Robert Haas c9ac00e6ec Teach psql to display the comments on conversions and domains.
\dc and \dD now accept a "+" option, which will cause the comments to
be displayed.  Along the way, correct a few oversights in the previous
commit in this area, 3b17efdfdd - namely,
(1) when \dL+ is used, make description still be the last column, for
consistency with what we've done elsewhere; and (2) document the
difference between \dC and \dC+.

Josh Kupershmidt, with a couple of doc changes by me.
2011-08-08 12:26:13 -04:00
Robert Haas b69f2e3640 Teach vacuumlo to limit number of removals, via new -l option.
Also, handle failure better: don't just blindly keep trying to delete
stuff after the transaction has already failed.

Tim Lewis, reviewed by Josh Kupershmidt, with further hacking by me.
2011-08-08 09:16:45 -04:00
Peter Eisentraut 04b17684af Add "Compatibility" section to ALTER EXTENSION reference page
Almost all other pages have one; this one must have been forgotten.
2011-08-07 22:15:38 +03:00
Peter Eisentraut f29a004496 Remove whitespace from end of lines 2011-08-07 16:11:55 +03:00
Peter Eisentraut a559ed5ed6 Rename "Example" sections to "Examples" in dblink chapter
For consistency with other man pages.
2011-08-07 15:51:04 +03:00
Peter Eisentraut 6ef2448796 Fix a whitespace issue with the man pages
There is what may actually be a mistake in our markup.  The problem is
in a situation like

<para>
 <command>FOO</command> is ...

there is strictly speaking a line break before "FOO".  In the HTML
output, this does not appear to be a problem, but in the man page
output, this shows up, so you get double blank lines at odd places.

So far, we have attempted to work around this with an XSL hack, but
that causes other problems, such as creating run-ins in places like

<acronym>SQL</acronym> <command>COPY</command>

So fix the problem properly by removing the extra whitespace.  I only
fixed the problems that affect the man page output, not all the
places.
2011-08-07 10:55:32 +03:00
Tom Lane ffcf5a6c41 Fix thinko in documentation of local_preload_libraries.
Somebody added a cross-reference to shared_preload_libraries, but wrote the
wrong variable name when they did it (and didn't bother to make it a link
either).

Spotted by Christoph Anton Mitterer.
2011-08-05 21:18:02 -04:00
Robert Haas c4096c7639 Allow per-column foreign data wrapper options.
Shigeru Hanada, with fairly minor editing by me.
2011-08-05 13:24:03 -04:00
Bruce Momjian 4262e61d64 Fix markup for recent wal_level clarification.
Backpatch to 9.1 and 9.0.
2011-08-04 15:02:02 -04:00
Robert Haas 3b17efdfdd Teach psql to display comments on languages and casts.
The output of \dL (list languages) is fairly narrow, so we just always
display the comment.  \dC (list casts) can get fairly wide, so we only
display comments if the new \dC+ option is specified.

Josh Kupershmidt
2011-08-04 12:22:26 -04:00
Bruce Momjian 38de5aad54 In documentaiton, clarify which commands have reduced WAL volume for
wal_level = minimum.

Backpatch to 9.1 and 9.0.
2011-08-04 12:06:53 -04:00
Robert Haas a8302803ab Fix typo.
Noted by Josh Kupershmidt.
2011-07-27 11:20:07 -04:00