Commit Graph

11387 Commits

Author SHA1 Message Date
Peter Eisentraut cdeb79adcf Fix typos 2013-09-15 11:01:14 -04:00
Bruce Momjian 2885006afc docs: Update libpq and testlo examples
Josh Kupershmidt
2013-09-10 21:03:11 -04:00
Peter Eisentraut b34f8f409b Show schemas in information_schema.schemata that the current has access to
Before, it would only show schemas that the current user owns.  Per
discussion, the new behavior is more useful and consistent for PostgreSQL.
2013-09-09 22:25:37 -04:00
Kevin Grittner 277607d600 Eliminate pg_rewrite.ev_attr column and related dead code.
Commit 95ef6a3448 removed the
ability to create rules on an individual column as of 7.3, but
left some residual code which has since been useless.  This cleans
up that dead code without any change in behavior other than
dropping the useless column from the catalog.
2013-09-05 14:03:43 -05:00
Jeff Davis be6fcb671e Improve Range Types and Exclusion Constraints example.
Make the examples self-contained to avoid confusion. Per bug report
8367 from KOIZUMI Satoru.
2013-09-04 23:30:27 -07:00
Tom Lane 546f7c2e38 Don't fail for bad GUCs in CREATE FUNCTION with check_function_bodies off.
The previous coding attempted to activate all the GUC settings specified
in SET clauses, so that the function validator could operate in the GUC
environment expected by the function body.  However, this is problematic
when restoring a dump, since the SET clauses might refer to database
objects that don't exist yet.  We already have the parameter
check_function_bodies that's meant to prevent forward references in
function definitions from breaking dumps, so let's change CREATE FUNCTION
to not install the SET values if check_function_bodies is off.

Authors of function validators were already advised not to make any
"context sensitive" checks when check_function_bodies is off, if indeed
they're checking anything at all in that mode.  But extend the
documentation to point out the GUC issue in particular.

(Note that we still check the SET clauses to some extent; the behavior
with !check_function_bodies is now approximately equivalent to what ALTER
DATABASE/ROLE have been doing for awhile with context-dependent GUCs.)

This problem can be demonstrated in all active branches, so back-patch
all the way.
2013-09-03 18:32:20 -04:00
Tom Lane 0d3f4406df Allow aggregate functions to be VARIADIC.
There's no inherent reason why an aggregate function can't be variadic
(even VARIADIC ANY) if its transition function can handle the case.
Indeed, this patch to add the feature touches none of the planner or
executor, and little of the parser; the main missing stuff was DDL and
pg_dump support.

It is true that variadic aggregates can create the same sort of ambiguity
about parameters versus ORDER BY keys that was complained of when we
(briefly) had both one- and two-argument forms of string_agg().  However,
the policy formed in response to that discussion only said that we'd not
create any built-in aggregates with varying numbers of arguments, not that
we shouldn't allow users to do it.  So the logical extension of that is
we can allow users to make variadic aggregates as long as we're wary about
shipping any such in core.

In passing, this patch allows aggregate function arguments to be named, to
the extent of remembering the names in pg_proc and dumping them in pg_dump.
You can't yet call an aggregate using named-parameter notation.  That seems
like a likely future extension, but it'll take some work, and it's not what
this patch is really about.  Likewise, there's still some work needed to
make window functions handle VARIADIC fully, but I left that for another
day.

initdb forced because of new aggvariadic field in Aggref parse nodes.
2013-09-03 17:08:46 -04:00
Tom Lane 7489eb4d3b Docs: wording improvements in discussion of timestamp arithmetic.
I started out just to fix the broken markup in commit
1c20857661, but got distracted by
copy-editing.  I see Bruce already fixed the markup, but I'll
commit the wordsmithing anyway.
2013-09-03 16:28:56 -04:00
Bruce Momjian b642bc55fa doc: Fix SGML markup for date patch 2013-09-03 16:06:24 -04:00
Bruce Momjian 1c20857661 Docs: add paragraph about date/timestamp subtraction
per suggestion from Francisco Olart
2013-09-03 13:24:39 -04:00
Robert Haas 9d323bda2e docs: Clarify that we also support Solaris versions greater than 10.
MauMau
2013-09-03 11:16:37 -04:00
Andrew Dunstan f002dc3d4d Fix relfrozenxid query in docs to include TOAST tables.
The original query ignored TOAST tables which could result in tables
needing a vacuum not being reported.

Backpatch to all live branches.
2013-09-02 14:38:12 -04:00
Tom Lane 244c8b466a Update "Using EXPLAIN" documentation examples using current code.
It seems like a good idea to update these examples since some fairly
basic planner behaviors have changed in 9.3; notably that the startup cost
for an indexscan plan node is no longer invariably estimated at 0.00.
2013-09-01 19:43:02 -04:00
Tom Lane f49f8de074 Update 9.3 release notes.
Some corrections, a lot of copy-editing.

Set projected release date as 2013-09-09.
2013-08-31 23:53:24 -04:00
Robert Haas 090d0f2050 Allow discovery of whether a dynamic background worker is running.
Using the infrastructure provided by this patch, it's possible either
to wait for the startup of a dynamically-registered background worker,
or to poll the status of such a worker without waiting.  In either
case, the current PID of the worker process can also be obtained.
As usual, worker_spi is updated to demonstrate the new functionality.

Patch by me.  Review by Andres Freund.
2013-08-28 14:08:13 -04:00
Heikki Linnakangas da85fb4747 Accept multiple -I, -P, -T and -n options in pg_restore.
We already did this for -t (--table) in 9.3, but missed the other similar
options. For consistency, allow all of them to be specified multiple times.

Unfortunately it's too late to sneak this into 9.3, so commit to master
only.
2013-08-28 09:43:34 +03:00
Robert Haas 8d00ab6306 doc: Explain that ereport doesn't return for ERROR or higher levels.
Christophe Pettus
2013-08-26 14:27:43 -04:00
Bruce Momjian 5dcc48c2c7 docs: Remove second 'trim' index reference
Per suggestion from Vik Fearing
2013-08-21 07:32:48 -04:00
Bruce Momjian b3cc173e19 release notes: update link to 9.3 PL/pgSQL constraint error info
Backpatch to 9.3.

Pavel Stehule
2013-08-20 09:39:08 -04:00
Bruce Momjian 1bc5935b67 release notes: remove username from 9.3 major item
Etsuro Fujita
2013-08-19 12:26:22 -04:00
Bruce Momjian 175ec8de47 release notes: update 9.3 major feature list
Backpatch to 9.3.
2013-08-16 18:01:05 -04:00
Bruce Momjian e91f2bb3ee release notes: Update to 9.3 git current
Backpatch to 9.3, of course.
2013-08-16 16:54:48 -04:00
Bruce Momjian 5368a23eeb docs: document TRIM "comma" syntax
This syntax is supported by the parser, but is non-standard.

_Not_ backpatched to 9.3 in case we change our minds.
2013-08-14 17:26:36 -04:00
Bruce Momjian b52cd9d022 9.3 release notes: move foreign table item
Move item about foreign data wrappers supporting inserts/updates/deletes
to object manipulation.

From Etsuro Fujita
2013-08-13 12:49:24 -04:00
Bruce Momjian f738156f51 docs: mention Julian is midnight _UTC_
(Yes, there was no UTC back then, but we compute it that way.)
Backpatch to 9.3.
2013-08-09 21:46:13 -04:00
Bruce Momjian 72039b1d8d Docs: Document to_*() Julian values are integers
Backpatch to 9.3.
Per request from Marc Dahn
2013-08-09 19:25:51 -04:00
Fujii Masao 0e65755c08 Document how auto_explain.log_timing can be changed. 2013-08-09 22:13:28 +09:00
Fujii Masao ee08a78a81 Fix inaccurate description of tablespace.
Currently we don't need to update the pg_tablespace catalog
after redefining the symbolic links to the tablespaces
because pg_tablespace.spclocation column was removed in
PostgreSQL 9.2.

Back patch to 9.2 where pg_tablespace.spclocation was removed.

Ian Barwick, with minor change by me.
2013-07-31 22:35:12 +09:00
Greg Stark c62736cc37 Add SQL Standard WITH ORDINALITY support for UNNEST (and any other SRF)
Author: Andrew Gierth, David Fetter
Reviewers: Dean Rasheed, Jeevan Chalke, Stephen Frost
2013-07-29 16:38:01 +01:00
Bruce Momjian 5691de6c95 pg_upgrade docs: don't use cluster for binary/lib
In a few cases, pg_upgrade said old/new cluster location when it meant
old/new Postgres install location, so fix those.
Per private email report
2013-07-26 13:52:01 -04:00
Tom Lane 3d13623d75 Prevent leakage of SPI tuple tables during subtransaction abort.
plpgsql often just remembers SPI-result tuple tables in local variables,
and has no mechanism for freeing them if an ereport(ERROR) causes an escape
out of the execution function whose local variable it is.  In the original
coding, that wasn't a problem because the tuple table would be cleaned up
when the function's SPI context went away during transaction abort.
However, once plpgsql grew the ability to trap exceptions, repeated
trapping of errors within a function could result in significant
intra-function-call memory leakage, as illustrated in bug #8279 from
Chad Wagner.

We could fix this locally in plpgsql with a bunch of PG_TRY/PG_CATCH
coding, but that would be tedious, probably slow, and prone to bugs of
omission; moreover it would do nothing for similar risks elsewhere.
What seems like a better plan is to make SPI itself responsible for
freeing tuple tables at subtransaction abort.  This patch attacks the
problem that way, keeping a list of live tuple tables within each SPI
function context.  Currently, such freeing is automatic for tuple tables
made within the failed subtransaction.  We might later add a SPI call to
mark a tuple table as not to be freed this way, allowing callers to opt
out; but until someone exhibits a clear use-case for such behavior, it
doesn't seem worth bothering.

A very useful side-effect of this change is that SPI_freetuptable() can
now defend itself against bad calls, such as duplicate free requests;
this should make things more robust in many places.  (In particular,
this reduces the risks involved if a third-party extension contains
now-redundant SPI_freetuptable() calls in error cleanup code.)

Even though the leakage problem is of long standing, it seems imprudent
to back-patch this into stable branches, since it does represent an API
semantics change for SPI users.  We'll patch this in 9.3, but live with
the leakage in older branches.
2013-07-25 16:46:14 -04:00
Robert Haas fd27b99919 pgstattuple: Doc update for previous commit.
In my previous change to make pgstattuple use SnapshotDirty rather
than SnapshotNow, I failed to notice that the documenation also
needed to be updated to match.  Fix.
2013-07-25 16:36:49 -04:00
Stephen Frost 8312832567 Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL
This adds the ability to get the call stack as a string from within a
PL/PgSQL function, which can be handy for logging to a table, or to
include in a useful message to an end-user.

Pavel Stehule, reviewed by Rushabh Lathia and rather heavily whacked
around by Stephen Frost.
2013-07-24 18:53:27 -04:00
Peter Eisentraut 2f1fa75a0c doc: Remove tab from SGML file 2013-07-22 21:02:12 -04:00
Tatsuo Ishii fc9f4e9f8c Add --rate option.
This controls the target transaction rate to certain tps, rather than
maximum. Patch contributed by Fabien COELHO, reviewed by Greg Smith,
and slight editing by me.
2013-07-23 08:40:22 +09:00
Robert Haas f40a318eea Remove bgw_sighup and bgw_sigterm.
Per discussion on pgsql-hackers, these aren't really needed.  Interim
versions of the background worker patch had the worker starting with
signals already unblocked, which would have made this necessary.
But the final version does not, so we don't really need it; and it
doesn't work well with the new facility for starting dynamic background
workers, so just rip it out.

Also per discussion on pgsql-hackers, back-patch this change to 9.3.
It's best to get the API break out of the way before we do an
official release of this facility, to avoid more pain for extension
authors later.
2013-07-22 14:13:00 -04:00
Alvaro Herrera 0aeb5ae204 Silence compiler warning on an unused variable
Also, tweak wording in comments (per Andres) and documentation (myself)
to point out that it's the database's default tablespace that can be
passed as 0, not DEFAULTTABLESPACE_OID.  Robert Haas noticed the bug in
the code, but didn't update the accompanying prose.
2013-07-22 13:15:13 -04:00
Robert Haas f01d1ae3a1 Add infrastructure for mapping relfilenodes to relation OIDs.
Future patches are expected to introduce logical replication that
works by decoding WAL.  WAL contains relfilenodes rather than relation
OIDs, so this infrastructure will be needed to find the relation OID
based on WAL contents.

If logical replication does not make it into this release, we probably
should consider reverting this, since it will add some overhead to DDL
operations that create new relations.  One additional index insert per
pg_class row is not a large overhead, but it's more than zero.
Another way of meeting the needs of logical replication would be to
the relation OID to WAL, but that would burden DML operations, not
only DDL.

Andres Freund, with some changes by me.  Design review, in earlier
versions, by Álvaro Herrera.
2013-07-22 11:09:10 -04:00
Robert Haas c8fb821afc doc: Fix typos in conversion names.
David Christensen
2013-07-19 10:53:41 -04:00
Stephen Frost 4cbe3ac3e8 WITH CHECK OPTION support for auto-updatable VIEWs
For simple views which are automatically updatable, this patch allows
the user to specify what level of checking should be done on records
being inserted or updated.  For 'LOCAL CHECK', new tuples are validated
against the conditionals of the view they are being inserted into, while
for 'CASCADED CHECK' the new tuples are validated against the
conditionals for all views involved (from the top down).

This option is part of the SQL specification.

Dean Rasheed, reviewed by Pavel Stehule
2013-07-18 17:10:16 -04:00
Fujii Masao 1dc118660b Fix pgstattuple functions to use regclass-type as the argument.
This allows us to specify the target relation with several expressions,
'relname', 'schemaname.relname' and OID in all pgstattuple functions.
pgstatindex() and pg_relpages() could not accept OID as the argument
so far.

Per discussion on -hackers, we decided to keep two types of interfaces,
with regclass-type and TEXT-type argument, for each pgstattuple
function because of the backward-compatibility issue. The functions
which have TEXT-type argument will be deprecated in the future release.

Patch by Satoshi Nagayasu, reviewed by Rushabh Lathia and Fujii Masao.
2013-07-19 03:50:20 +09:00
Peter Eisentraut e8b1d1befe doc: Remove tab from SGML file 2013-07-17 19:41:45 -04:00
Fujii Masao 750f43685b Fix typo in previous pgbench --progress patch. 2013-07-18 01:21:30 +09:00
Stephen Frost f2719f6975 Use correct parameter name for view_option_value
The documentation for ALTER VIEW had a minor copy-and-paste error in
defining the parameters.  Noticed when reviewing the WITH CHECK OPTION
patch.

Backpatch to 9.2 where this was first introduced.
2013-07-17 10:50:39 -04:00
Noah Misch b560ec1b0d Implement the FILTER clause for aggregate function calls.
This is SQL-standard with a few extensions, namely support for
subqueries and outer references in clause expressions.

catversion bump due to change in Aggref and WindowFunc.

David Fetter, reviewed by Dean Rasheed.
2013-07-16 20:15:36 -04:00
Tatsuo Ishii 4a87f308b3 Add --progress option to show progress report
Patch contributed by Fabien COELHO, reviewed by KONDO Mitsumasa.
2013-07-17 08:05:37 +09:00
Kevin Grittner cc1965a99b Add support for REFRESH MATERIALIZED VIEW CONCURRENTLY.
This allows reads to continue without any blocking while a REFRESH
runs.  The new data appears atomically as part of transaction
commit.

Review questioned the Assert that a matview was not a system
relation.  This will be addressed separately.

Reviewed by Hitoshi Harada, Robert Haas, Andres Freund.
Merged after review with security patch f3ab5d4.
2013-07-16 12:55:44 -05:00
Robert Haas 7f7485a0cd Allow background workers to be started dynamically.
There is a new API, RegisterDynamicBackgroundWorker, which allows
an ordinary user backend to register a new background writer during
normal running.  This means that it's no longer necessary for all
background workers to be registered during processing of
shared_preload_libraries, although the option of registering workers
at that time remains available.

When a background worker exits and will not be restarted, the
slot previously used by that background worker is automatically
released and becomes available for reuse.  Slots used by background
workers that are configured for automatic restart can't (yet) be
released without shutting down the system.

This commit adds a new source file, bgworker.c, and moves some
of the existing control logic for background workers there.
Previously, there was little enough logic that it made sense to
keep everything in postmaster.c, but not any more.

This commit also makes the worker_spi contrib module into an
extension and adds a new function, worker_spi_launch, which can
be used to demonstrate the new facility.
2013-07-16 13:02:15 -04:00
Noah Misch 01337d46eb Document the OVER keyword as being unreserved.
It became so in commit 5893ffa79c.

David Fetter, extracted from a larger patch.
2013-07-14 19:49:02 -04:00
Peter Eisentraut 070518ddab Add session_preload_libraries configuration parameter
This is like shared_preload_libraries except that it takes effect at
backend start and can be changed without a full postmaster restart.  It
is like local_preload_libraries except that it is still only settable by
a superuser.  This can be a better way to load modules such as
auto_explain.

Since there are now three preload parameters, regroup the documentation
a bit.  Put all parameters into one section, explain common
functionality only once, update the descriptions to reflect current and
future realities.

Reviewed-by: Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-07-12 21:23:50 -04:00