Commit Graph

2400 Commits

Author SHA1 Message Date
Fujii Masao 750f43685b Fix typo in previous pgbench --progress patch. 2013-07-18 01:21:30 +09: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
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
Robert Haas 67ccbb080d vacuumlo: Use a cursor to limit client-side memory usage.
This prevents the client from gobbling up too much memory when the
number of large objects to be removed is very large.

Andrew Dunstan, reviewed by Josh Kupershmidt
2013-07-15 10:51:27 -04:00
Heikki Linnakangas b5ed21998c Fix pg_test_fsync, broken by xloginsert scaling patch.
I didn't realize that ALIGNOF_XLOG_BUFFER was used in pg_test_fsync.
2013-07-08 13:04:07 +03:00
Peter Eisentraut 55f100efc6 pgbench: Silence compiler warning
Explicitly ignore return value from write(), to silence warning.  This
warning only appeared under --disable-thread-safety.
2013-07-07 07:27:22 -04:00
Fujii Masao 2ef085d0e6 Get rid of pg_class.reltoastidxid.
Treat TOAST index just the same as normal one and get the OID
of TOAST index from pg_index but not pg_class.reltoastidxid.
This change allows us to handle multiple TOAST indexes, and
which is required infrastructure for upcoming
REINDEX CONCURRENTLY feature.

Patch by Michael Paquier, reviewed by Andres Freund and me.
2013-07-04 03:24:09 +09:00
Bruce Momjian cce5d851ed pg_upgrade: revert changing '' to ""
On the command line, GUC option strings are handled by the guc parser,
not by the shell parser, so '' is the proper way to represent a
zero-length string.  This reverts commit
3132a9b7ab.
2013-07-02 10:29:49 -04:00
Robert Haas 568d4138c6 Use an MVCC snapshot, rather than SnapshotNow, for catalog scans.
SnapshotNow scans have the undesirable property that, in the face of
concurrent updates, the scan can fail to see either the old or the new
versions of the row.  In many cases, we work around this by requiring
DDL operations to hold AccessExclusiveLock on the object being
modified; in some cases, the existing locking is inadequate and random
failures occur as a result.  This commit doesn't change anything
related to locking, but will hopefully pave the way to allowing lock
strength reductions in the future.

The major issue has held us back from making this change in the past
is that taking an MVCC snapshot is significantly more expensive than
using a static special snapshot such as SnapshotNow.  However, testing
of various worst-case scenarios reveals that this problem is not
severe except under fairly extreme workloads.  To mitigate those
problems, we avoid retaking the MVCC snapshot for each new scan;
instead, we take a new snapshot only when invalidation messages have
been processed.  The catcache machinery already requires that
invalidation messages be sent before releasing the related heavyweight
lock; else other backends might rely on locally-cached data rather
than scanning the catalog at all.  Thus, making snapshot reuse
dependent on the same guarantees shouldn't break anything that wasn't
already subtly broken.

Patch by me.  Review by Michael Paquier and Andres Freund.
2013-07-02 09:47:01 -04:00
Bruce Momjian 3132a9b7ab pg_upgrade: use "" rather than '', for Windows
If we ever support unix sockets on Windows, we should use "" rather than
'' for zero-length strings on the command-line, so use that.
2013-07-01 14:45:45 -04:00
Bruce Momjian 06b804377c Remove undocumented -h (help) option
The -h option was not supported by many tools, and not documented, so
remove them for consistency from pg_upgrade, pg_test_fsync, and
pg_test_timing.
2013-07-01 12:40:33 -04:00
Bruce Momjian f85136106d pg_upgrade: pass username to analyze script
If -U (user) is specified, pass the username into the created analyze
script.
Per request from Ray Stell
2013-06-28 19:11:51 -04:00
Bruce Momjian e029275cde pg_upgrade: remove -h option
-h (help) is not needed;  pg_upgrade already supports --help and -?,
which is consistent with other tools.
2013-06-28 18:10:13 -04:00
Bruce Momjian fb771f9086 pg_upgrade: trim down --help and doc option descriptions
Previous code had old/new prefixes on option values, e.g.
--old-datadir=OLDDATADIR.  Remove them, for simplicity;  now:
--old-datadir=DATADIR.  Also update docs to do the same.
2013-06-28 18:01:49 -04:00
Bruce Momjian 457d6cf049 pg_upgrade: change -u to -U, for consistency
Change -u (user) option to -U, for consistency with other tools like
pg_dump and psql.  Also expand --user to --username, again for
consistency.
BACKWARD INCOMPATIBILITY
2013-06-28 17:27:43 -04:00
Robert Haas 682d977f81 pgbench: Fix inadvertent inconsistency in help message.
Per report from Fujii Masao.
2013-06-27 10:33:04 -04:00
Robert Haas 79cddb1841 pgbench: Add long options for all existing short options.
Fabien Coelho, reviewed by Fabrízio de Royes Mello, with some further
changes by me
2013-06-27 08:57:27 -04:00
Heikki Linnakangas b23160889c Add :client_id automatic variable for custom pgbench scripts.
This makes it easier to write custom scripts that have different logic for
each client.

Gurjeet Singh, with some changes by me.
2013-06-14 23:31:44 +03:00
Tom Lane dc3eb56383 Improve updatability checking for views and foreign tables.
Extend the FDW API (which we already changed for 9.3) so that an FDW can
report whether specific foreign tables are insertable/updatable/deletable.
The default assumption continues to be that they're updatable if the
relevant executor callback function is supplied by the FDW, but finer
granularity is now possible.  As a test case, add an "updatable" option to
contrib/postgres_fdw.

This patch also fixes the information_schema views, which previously did
not think that foreign tables were ever updatable, and fixes
view_is_auto_updatable() so that a view on a foreign table can be
auto-updatable.

initdb forced due to changes in information_schema views and the functions
they rely on.  This is a bit unfortunate to do post-beta1, but if we don't
change this now then we'll have another API break for FDWs when we do
change it.

Dean Rasheed, somewhat editorialized on by Tom Lane
2013-06-12 17:53:33 -04:00
Tom Lane e0b451e432 Tweak postgres_fdw regression test so autovacuum doesn't change results.
Autovacuum occurring while the test runs could allow some of the inserts to
go into recycled space, thus changing the output ordering of later queries.
While we could complicate those queries to force sorting of their output
rows, it doesn't seem like that would make the test better in any
meaningful way, and conceivably it could hide unexpected diffs.  Instead,
tweak the affected queries so that the inserted rows aren't updated by the
following UPDATE.  Per buildfarm.
2013-06-09 19:41:52 -04:00
Heikki Linnakangas 79e15c7d86 Fix off-by-one in pg_xlogdump -r option.
Because of the bug, -r would not accept the rmgr with the highest ID.
2013-06-04 18:51:43 +03:00
Stephen Frost c9fc28a7f1 Minor spelling fixes
Fix a few spelling mistakes.

Per bug report #8193 from Lajos Veres.
2013-06-01 10:18:59 -04:00
Stephen Frost 551938ae22 Post-pgindent cleanup
Make slightly better decisions about indentation than what pgindent
is capable of.  Mostly breaking out long function calls into one
line per argument, with a few other minor adjustments.

No functional changes- all whitespace.
pgindent ran cleanly (didn't change anything) after.
Passes all regressions.
2013-06-01 09:38:15 -04:00
Bruce Momjian 9af4159fce pgindent run for release 9.3
This is the first run of the Perl-based pgindent script.  Also update
pgindent instructions.
2013-05-29 16:58:43 -04:00
Heikki Linnakangas 230e92c82b Remove pageinspect--1.0.sql
We're not installing it anymore.

Michael Paquier
2013-05-24 08:11:44 -04:00
Tom Lane b142068622 Allow CREATE FOREIGN TABLE to include SERIAL columns.
The behavior is that the required sequence is created locally, which is
appropriate because the default expression will be evaluated locally.
Per gripe from Brad Nicholson that this case was refused with a confusing
error message.  We could have improved the error message but it seems
better to just allow the case.

Also, remove ALTER TABLE's arbitrary prohibition against being applied to
foreign tables, which was pretty inconsistent considering we allow it for
views, sequences, and other relation types that aren't even called tables.
This is needed to avoid breaking pg_dump, which sometimes emits column
defaults using separate ALTER TABLE commands.  (I think this can happen
even when the default is not associated with a sequence, so that was a
pre-existing bug once we allowed column defaults for foreign tables.)
2013-05-15 19:03:29 -04:00
Peter Eisentraut d2b920cded pg_upgrade: Replace tabs in output string constants by spaces 2013-05-13 21:42:19 -04:00
Peter Eisentraut f0ed3a8a99 pgbench: Fix order of options in --help output 2013-05-11 22:02:53 -04:00
Peter Eisentraut a4fd3366a6 pg_xlogdump: Improve --help output 2013-05-11 22:02:53 -04:00
Tom Lane 8cade04c10 Fix buildfarm incompatibility in updated pg_upgrade test script.
Looks like some versions of the buildfarm script try to set the port via
--port in $EXTRA_REGRESS_OPTS.  Override that ...
2013-05-11 16:14:19 -04:00
Tom Lane 7e2b1c03ce Make pg_upgrade's test script attempt to select a non-conflicting port.
Previously, the port number used in this test script was hard-wired at
pg_upgrade's default of 50432; which is not so great because parallel build
runs might conflict.  Commit 3d53173e20
removed this setting for the postmasters started by the script proper
(not by pg_upgrade), which didn't do anything to fix that problem and also
guaranteed a failure if there was a live postmaster at the build's default
port number.  Instead, select a non-conflicting temporary port number in
the same way that pg_regress.c does.  (Its method isn't entirely
bulletproof, but given the lack of complaints I'm not going to worry
about that today.)

In passing, unset MAKEFLAGS and MAKELEVEL to avoid problems with the
script's internal invocations of make, for the same reason pg_regress.c
does: it could cause problems in a parallel make.
2013-05-11 14:22:18 -04:00
Tom Lane 477b5a0e24 Fix pgp_pub_decrypt() so it works for secret keys with passwords.
Per report from Keith Fiske.

Marko Kreen
2013-05-10 13:06:48 -04:00
Tom Lane 1c36700e9e Use pg_dump's --quote-all-identifiers option in pg_upgrade.
This helps guard against changes in the set of reserved keywords from
one version to another.  In theory it should only be an issue if we
de-reserve a keyword in a newer release, since that can create the type
of problem shown in bug #8128.

Back-patch to 9.1 where the --quote-all-identifiers option was added.
2013-05-09 17:34:34 -04:00
Heikki Linnakangas 4b06c1820a The data structure used in unaccent is a trie, not suffix tree.
Fix the term used in variable and struct names, and comments.

Alexander Korotkov
2013-05-08 20:58:50 +03:00
Bruce Momjian 095018bc32 pg_test_fsync: update output to show usecs/op clearer 2013-05-02 10:27:12 -04:00
Simon Riggs 87d3b35a1c Fix pg_upgrade for 9.3 with data checksums.
Previous changes misconstrued pg_upgrade internals
causing build farm breakages.
2013-04-30 15:49:24 +01:00
Simon Riggs be475a2473 Revert previous temporary patch 2013-04-30 15:32:10 +01:00
Simon Riggs 28377213bb Temporarily silence pg_upgrade's checksums check 2013-04-30 14:34:47 +01:00
Peter Eisentraut 3d53173e20 pg_upgrade: Remove PGPORT handling from test suite
This code was left over from when pg_upgrade paid attention to PGPORT.
Now it would only affects the regression test run before the test run of
pg_upgrade.  You can still set PGPORT for that, but there is no reason
to have the test driver default it to 50432.
2013-04-29 22:17:29 -04:00
Peter Eisentraut 187ca5e8e9 Revert "pg_ctl: Add idempotent option"
This reverts commit 8730618458.  The
behavior in certain cases is still being debated, and it's too late to
solve this before beta.
2013-04-29 21:55:12 -04:00
Tom Lane f8db76e875 Editorialize a bit on new ProcessUtility() API.
Choose a saner ordering of parameters (adding a new input param after
the output params seemed a bit random), update the function's header
comment to match reality (cmon folks, is this really that hard?),
get rid of useless and sloppily-defined distinction between
PROCESS_UTILITY_SUBCOMMAND and PROCESS_UTILITY_GENERATED.
2013-04-28 00:18:45 -04:00
Heikki Linnakangas cc7b0c2553 Remove prototype for cube(text) function that doesn't exist anymore.
Adrian Schreyer
2013-04-23 13:49:06 +03:00
Tom Lane 3353583d7e Don't try to pass -I switch to postmaster in contrib/start-scripts/linux.
Undo thinko in commit 8730618458.
Per bug #8098 from Catherine Devlin.
2013-04-19 13:28:45 -04:00
Robert Haas 4580a4bd2c Fix typo in comment.
Fabrízio de Royes Mello
2013-04-19 09:32:49 -04:00
Bruce Momjian 5286963066 pg_upgrade: Add checksum C comment
We might eventually allow checksum to no-checksum upgrades.
2013-04-17 17:39:19 -04:00
Robert Haas f050457978 sepgsql: Minor improvement to test script, doc fix.
KaiGai Kohei
2013-04-17 09:55:24 -04:00
Robert Haas 0bf5c548d6 sepgsql: One more getObjectIdentity in lieu of getObjectDescription.
KaiGai Kohei, based on a suggestion from Álvaro Herrera
2013-04-17 09:52:59 -04:00
Tom Lane 410bed2ab8 Improve GiST index search performance for trigram regex queries.
The initial coding just descended the index if any of the target trigrams
were possibly present at the next level down.  But actually we can apply
trigramsMatchGraph() so as to take advantage of AND requirements when there
are some.  The input data might contain false positive matches, but that
can only result in a false positive result, not false negative, so it's
safe to do it this way.

Alexander Korotkov
2013-04-15 12:49:29 -04:00
Peter Eisentraut 8730618458 pg_ctl: Add idempotent option
This changes the behavior of the start and stop actions to exit
successfully if the server was already started or stopped.

This changes the default behavior of the start action:  Before, if the
server was already running, it would print a message and succeed.  Now,
that situation will result in an error.  When running in idempotent
mode, no message is printed and pg_ctl exits successfully.

It was considered to just make the idempotent behavior the default and
only option, but pg_upgrade needs the old behavior.
2013-04-13 23:42:42 -04:00