summaryrefslogtreecommitdiff
path: root/doc/src
AgeCommit message (Collapse)Author
2012-12-06Improve pl/pgsql to support composite-type expressions in RETURN.Tom Lane
For some reason lost in the mists of prehistory, RETURN was only coded to allow a simple reference to a composite variable when the function's return type is composite. Allow an expression instead, while preserving the efficiency of the original code path in the case where the expression is indeed just a composite variable's name. Likewise for RETURN NEXT. As is true in various other places, the supplied expression must yield exactly the number and data types of the required columns. There was some discussion of relaxing that for pl/pgsql, but no consensus yet, so this patch doesn't address that. Asif Rehman, reviewed by Pavel Stehule
2012-12-06Background worker processesAlvaro Herrera
Background workers are postmaster subprocesses that run arbitrary user-specified code. They can request shared memory access as well as backend database connections; or they can just use plain libpq frontend database connections. Modules listed in shared_preload_libraries can register background workers in their _PG_init() function; this is early enough that it's not necessary to provide an extra GUC option, because the necessary extra resources can be allocated early on. Modules can install more than one bgworker, if necessary. Care is taken that these extra processes do not interfere with other postmaster tasks: only one such process is started on each ServerLoop iteration. This means a large number of them could be waiting to be started up and postmaster is still able to quickly service external connection requests. Also, shutdown sequence should not be impacted by a worker process that's reasonably well behaved (i.e. promptly responds to termination signals.) The current implementation lets worker processes specify their start time, i.e. at what point in the server startup process they are to be started: right after postmaster start (in which case they mustn't ask for shared memory access), when consistent state has been reached (useful during recovery in a HOT standby server), or when recovery has terminated (i.e. when normal backends are allowed). In case of a bgworker crash, actions to take depend on registration data: if shared memory was requested, then all other connections are taken down (as well as other bgworkers), just like it were a regular backend crashing. The bgworker itself is restarted, too, within a configurable timeframe (which can be configured to be never). More features to add to this framework can be imagined without much effort, and have been discussed, but this seems good enough as a useful unit already. An elementary sample module is supplied. Author: Álvaro Herrera This patch is loosely based on prior patches submitted by KaiGai Kohei, and unsubmitted code by Simon Riggs. Reviewed by: KaiGai Kohei, Markus Wanner, Andres Freund, Heikki Linnakangas, Simon Riggs, Amit Kapila
2012-12-05Add pgstatginindex() function to get the size of the GIN pending list.Heikki Linnakangas
Fujii Masao, reviewed by Kyotaro Horiguchi.
2012-12-03Add support for LDAP URLsPeter Eisentraut
Allow specifying LDAP authentication parameters as RFC 4516 LDAP URLs.
2012-12-03Add initdb --sync-only option to sync the data directory to durableBruce Momjian
storage. Have pg_upgrade use it, and enable server options fsync=off and full_page_writes=off. Document that users turning fsync from off to on should run initdb --sync-only. [ Previous commit was incorrectly applied as a git merge. ]
2012-12-03Revert initdb --sync-only patch that had incorrect commit messages.Bruce Momjian
2012-12-03dummy commitBruce Momjian
2012-12-03dummy commitBruce Momjian
2012-12-03dummy commitBruce Momjian
2012-12-03Update release notes for 9.2.2, 9.1.7, 9.0.11, 8.4.15, 8.3.22.Tom Lane
2012-12-03Fix documentation of path(polygon) function.Tom Lane
Obviously, this returns type "path", but somebody made a copy-and-pasteo long ago. Dagfinn Ilmari Mannsåker
2012-12-02Recommend triggers, not rules, in the CREATE VIEW reference page.Tom Lane
We've generally recommended use of INSTEAD triggers over rules since that feature was added; but this old text in the CREATE VIEW reference page didn't get the memo. Noted by Thomas Kellerer.
2012-12-01COPY FREEZE and mark committed on fresh tables.Simon Riggs
When a relfilenode is created in this subtransaction or a committed child transaction and it cannot otherwise be seen by our own process, mark tuples committed ahead of transaction commit for all COPY commands in same transaction. If FREEZE specified on COPY and pre-conditions met then rows will also be frozen. Both options designed to avoid revisiting rows after commit, increasing performance of subsequent commands after data load and upgrade. pg_restore changes later. Simon Riggs, review comments from Heikki Linnakangas, Noah Misch and design input from Tom Lane, Robert Haas and Kevin Grittner
2012-12-01doc: Fix broken links to DocBook wikiPeter Eisentraut
2012-11-30Add libpq function PQconninfo()Magnus Hagander
This allows a caller to get back the exact conninfo array that was used to create a connection, including parameters read from the environment. In doing this, restructure how options are copied from the conninfo to the actual connection. Zoltan Boszormenyi and Magnus Hagander
2012-11-28Fix assorted bugs in CREATE/DROP INDEX CONCURRENTLY.Tom Lane
Commit 8cb53654dbdb4c386369eb988062d0bbb6de725e, which introduced DROP INDEX CONCURRENTLY, managed to break CREATE INDEX CONCURRENTLY via a poor choice of catalog state representation. The pg_index state for an index that's reached the final pre-drop stage was the same as the state for an index just created by CREATE INDEX CONCURRENTLY. This meant that the (necessary) change to make RelationGetIndexList ignore about-to-die indexes also made it ignore freshly-created indexes; which is catastrophic because the latter do need to be considered in HOT-safety decisions. Failure to do so leads to incorrect index entries and subsequently wrong results from queries depending on the concurrently-created index. To fix, add an additional boolean column "indislive" to pg_index, so that the freshly-created and about-to-die states can be distinguished. (This change obviously is only possible in HEAD. This patch will need to be back-patched, but in 9.2 we'll use a kluge consisting of overloading the formerly-impossible state of indisvalid = true and indisready = false.) In addition, change CREATE/DROP INDEX CONCURRENTLY so that the pg_index flag changes they make without exclusive lock on the index are made via heap_inplace_update() rather than a normal transactional update. The latter is not very safe because moving the pg_index tuple could result in concurrent SnapshotNow scans finding it twice or not at all, thus possibly resulting in index corruption. This is a pre-existing bug in CREATE INDEX CONCURRENTLY, which was copied into the DROP code. In addition, fix various places in the code that ought to check to make sure that the indexes they are manipulating are valid and/or ready as appropriate. These represent bugs that have existed since 8.2, since a failed CREATE INDEX CONCURRENTLY could leave a corrupt or invalid index behind, and we ought not try to do anything that might fail with such an index. Also fix RelationReloadIndexInfo to ensure it copies all the pg_index columns that are allowed to change after initial creation. Previously we could have been left with stale values of some fields in an index relcache entry. It's not clear whether this actually had any user-visible consequences, but it's at least a bug waiting to happen. In addition, do some code and docs review for DROP INDEX CONCURRENTLY; some cosmetic code cleanup but mostly addition and revision of comments. This will need to be back-patched, but in a noticeably different form, so I'm committing it to HEAD before working on the back-patch. Problem reported by Amit Kapila, diagnosis by Pavan Deolassee, fix by Tom Lane and Andres Freund.
2012-11-26Revert patch for taking fewer snapshots.Tom Lane
This reverts commit d573e239f03506920938bf0be56c868d9c3416da, "Take fewer snapshots". While that seemed like a good idea at the time, it caused execution to use a snapshot that had been acquired before locking any of the tables mentioned in the query. This created user-visible anomalies that were not present in any prior release of Postgres, as reported by Tomas Vondra. While this whole area could do with a redesign (since there are related cases that have anomalies anyway), it doesn't seem likely that any future patch would be reasonably back-patchable; and we don't want 9.2 to exhibit a behavior that's subtly unlike either past or future releases. Hence, revert to prior code while we rethink the problem.
2012-11-17doc: Put pg_temp into documentation indexPeter Eisentraut
Karl O. Pinc
2012-11-15doc: Put commas in the right place on pg_restore reference pagePeter Eisentraut
Karl O. Pinc
2012-11-12doc: Add link to CREATE TABLE AS on CREATE TABLE reference pagePeter Eisentraut
Karl O. Pinc
2012-11-12Use a stamp file for the XSLT HTML doc buildPeter Eisentraut
This way it works more like the DSSSL build, and dependencies are tracked better by make. Also copy the CSS stylesheet to the html directory. This was forgotten when the output directory was changed.
2012-11-11doc: "only relevant" -> "relevant only"Peter Eisentraut
Karl O. Pinc
2012-11-08XSLT stylesheet: Add slash to directory namePeter Eisentraut
Some versions of the XSLT stylesheets don't handle the missing slash correctly (they concatenate directory and file name without the slash). This might never have worked correctly.
2012-11-08Teach pg_basebackup and pg_receivexlog to reply to server keepalives.Heikki Linnakangas
Without this, the connection will be killed after timeout if wal_sender_timeout is set in the server. Original patch by Amit Kapila, modified by me to fit recent changes in the code.
2012-11-07In pg_upgrade docs, mention using base backup as part of rsync forBruce Momjian
logical replication upgrades. Backpatch to 9.2.
2012-11-07Make the streaming replication protocol messages architecture-independent.Heikki Linnakangas
We used to send structs wrapped in CopyData messages, which works as long as the client and server agree on things like endianess, timestamp format and alignment. That's good enough for running a standby server, which has to run on the same platform anyway, but it's useful for tools like pg_receivexlog to work across platforms. This breaks protocol compatibility of streaming replication, but we never promised that to be compatible across versions, anyway.
2012-11-01Fix typoPeter Eisentraut
2012-10-31Document that TCP keepalive settings read as 0 on Unix-socket connections.Tom Lane
Per bug #7631 from Rob Johnson. The code is operating as designed, but the docs didn't explain it.
2012-10-26In pg_dump, dump SEQUENCE SET items in the data not pre-data section.Tom Lane
Represent a sequence's current value as a separate TableDataInfo dumpable object, so that it can be dumped within the data section of the archive rather than in pre-data. This fixes an undesirable inconsistency between the meanings of "--data-only" and "--section=data", and also fixes dumping of sequences that are marked as extension configuration tables, as per a report from Marko Kreen back in July. The main cost is that we do one more SQL query per sequence, but that's probably not very meaningful in most databases. Back-patch to 9.1, since it has the extension configuration issue even though not the --section switch.
2012-10-23Add context info to OAT_POST_CREATE security hookAlvaro Herrera
... and have sepgsql use it to determine whether to check permissions during certain operations. Indexes that are being created as a result of REINDEX, for instance, do not need to have their permissions checked; they were already checked when the index was created. Author: KaiGai Kohei, slightly revised by me
2012-10-20Fix pg_dump's handling of DROP DATABASE commands in --clean mode.Tom Lane
In commit 4317e0246c645f60c39e6572644cff1cb03b4c65, I accidentally broke this behavior while rearranging code to ensure that --create wouldn't affect whether a DATABASE entry gets put into archive-format output. Thus, 9.2 would issue a DROP DATABASE command in --clean mode, which is either useless or dangerous depending on the usage scenario. It should not do that, and no longer does. A bright spot is that this refactoring makes it easy to allow the combination of --clean and --create to work sensibly, ie, emit DROP DATABASE then CREATE DATABASE before reconnecting. Ordinarily we'd consider that a feature addition and not back-patch it, but it seems silly to not include the extra couple of lines required in the 9.2 version of the code. Per report from Guillaume Lelarge, though this is slightly more extensive than his proposed patch.
2012-10-17Fix typo in previous commitSimon Riggs
2012-10-17Clarify hash index caution and copy to CREATE INDEX docsSimon Riggs
2012-10-11Improve replication connection timeouts.Heikki Linnakangas
Rename replication_timeout to wal_sender_timeout, and add a new setting called wal_receiver_timeout that does the same at the walreceiver side. There was previously no timeout in walreceiver, so if the network went down, for example, the walreceiver could take a long time to notice that the connection was lost. Now with the two settings, both sides of a replication connection will detect a broken connection similarly. It is no longer necessary to manually set wal_receiver_status_interval to a value smaller than the timeout. Both wal sender and receiver now automatically send a "ping" message if more than 1/2 of the configured timeout has elapsed, and it hasn't received any messages from the other end. Amit Kapila, heavily edited by me.
2012-10-10Create an improved FDW option validator function for contrib/dblink.Tom Lane
dblink now has its own validator function dblink_fdw_validator(), which is better than the core function postgresql_fdw_validator() because it gets the list of legal options from libpq instead of having a hard-wired list. Make the dblink extension module provide a standard foreign data wrapper dblink_fdw that encapsulates use of this validator, and recommend use of that wrapper instead of making up wrappers on the fly. Unfortunately, because ad-hoc wrappers *were* recommended practice previously, it's not clear when we can get rid of postgresql_fdw_validator without causing upgrade problems. But this is a step in the right direction. Shigeru Hanada, reviewed by KaiGai Kohei
2012-10-10Update obsolete text in fdwhandler.sgml.Tom Lane
Etsuro Fujita, with some wording adjustment by me.
2012-10-09Use tablespace_option consistently on doc pageSimon Riggs
Fujii Masao
2012-10-09Add microsecs/op display to pg_test_fsync utilitySimon Riggs
e.g. fsync 2103.613 ops/sec ( 475 microsecs/op) Peter Geoghegan
2012-10-08Fix lo_read, lo_write, lo_truncate to cope with "size_t" length parameters.Tom Lane
libpq defines these functions as accepting "size_t" lengths ... but the underlying backend functions expect signed int32 length parameters, and so will misinterpret any value exceeding INT_MAX. Fix the libpq side to throw error rather than possibly doing something unexpected. This is a bug of long standing, but I doubt it's worth back-patching. The problem is really pretty academic anyway with lo_read/lo_write, since any caller expecting sane behavior would have to have provided a multi-gigabyte buffer. It's slightly more pressing with lo_truncate, but still we haven't supported large objects over 2GB until now.
2012-10-07Improve documentation about large-object functions.Tom Lane
Copy-editing for previous patch, plus fixing some longstanding markup issues and oversights (like not mentioning that failures will set the PQerrorMessage string).
2012-10-07Add API for 64-bit large object access. Now users can access up toTatsuo Ishii
4TB large objects (standard 8KB BLCKSZ case). For this purpose new libpq API lo_lseek64, lo_tell64 and lo_truncate64 are added. Also corresponding new backend functions lo_lseek64, lo_tell64 and lo_truncate64 are added. inv_api.c is changed to handle 64-bit offsets. Patch contributed by Nozomi Anzai (backend side) and Yugo Nagata (frontend side, docs, regression tests and example program). Reviewed by Kohei Kaigai. Committed by Tatsuo Ishii with minor editings.
2012-10-05Improve LDAP authentication documentationPeter Eisentraut
Use the terms "simple bind" and "search+bind" consistently do distinguish the two modes (better than first mode and second mode in any case). They were already used in some places, now it's just more prominent. Split up the list of options into one for common options and one for each mode, for clarity. Add configuration examples for either mode.
2012-10-05Removed sentence about not being able to retrieve more than one row at a time,Michael Meskes
because it is not correct.
2012-10-04Fix permissions explanations in CREATE DATABASE and CREATE SCHEMA docs.Tom Lane
These reference pages still claimed that you have to be superuser to create a database or schema owned by a different role. That was true before 8.1, but it was changed in commits aa1110624c08298393dfce996f7b21809d98d3fd and f91370cd2faf1fd35a1ac74d84652a85ed841919 to allow assignment of ownership to any role you are a member of. However, at the time we were thinking of that primarily as a change to the ALTER OWNER rules, so the need to touch these two CREATE ref pages got missed.
2012-10-03Support CREATE SCHEMA IF NOT EXISTS.Tom Lane
Per discussion, schema-element subcommands are not allowed together with this option, since it's not very obvious what should happen to the element objects. Fabrízio de Royes Mello
2012-10-03Add --sampling-rate option to pgbench.Heikki Linnakangas
This allows logging only some fraction of transactions, greatly reducing the amount of log generated. Tomas Vondra, reviewed by Robert Haas and Jeff Janes.
2012-10-03Return the number of rows processed when COPY is executed through SPI.Heikki Linnakangas
You can now get the number of rows processed by a COPY statement in a PL/pgSQL function with "GET DIAGNOSTICS x = ROW_COUNT". Pavel Stehule, reviewed by Amit Kapila, with some editing by me.
2012-10-01The max shared_buffers value that initdb will choose was raised, update docs.Heikki Linnakangas
Jeff Janes
2012-09-29PL/Python: Convert oid to long/intPeter Eisentraut
oid is a numeric type, so transform it to the appropriate Python numeric type like the other ones.
2012-09-28Fix tar files emitted by pg_dump and pg_basebackup to be POSIX conformant.Tom Lane
Both programs got the "magic" string wrong, causing standard-conforming tar implementations to believe the output was just legacy tar format without any POSIX extensions. This doesn't actually matter that much, especially since pg_dump failed to fill the POSIX fields anyway, but still there is little point in emitting tar format if we can't be compliant with the standard. In addition, pg_dump failed to write the EOF marker correctly (there should be 2 blocks of zeroes not just one), pg_basebackup put the numeric group ID in the wrong place, and both programs had a pretty brain-dead idea of how to compute the checksum. Fix all that and improve the comments a bit. pg_restore is modified to accept either the correct POSIX-compliant "magic" string or the previous value. This part of the change will need to be back-patched to avoid an unnecessary compatibility break when a previous version tries to read tar-format output from 9.3 pg_dump. Brian Weaver and Tom Lane