postgresql/contrib
Andres Freund 168d5805e4 Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE.
The newly added ON CONFLICT clause allows to specify an alternative to
raising a unique or exclusion constraint violation error when inserting.
ON CONFLICT refers to constraints that can either be specified using a
inference clause (by specifying the columns of a unique constraint) or
by naming a unique or exclusion constraint.  DO NOTHING avoids the
constraint violation, without touching the pre-existing row.  DO UPDATE
SET ... [WHERE ...] updates the pre-existing tuple, and has access to
both the tuple proposed for insertion and the existing tuple; the
optional WHERE clause can be used to prevent an update from being
executed.  The UPDATE SET and WHERE clauses have access to the tuple
proposed for insertion using the "magic" EXCLUDED alias, and to the
pre-existing tuple using the table name or its alias.

This feature is often referred to as upsert.

This is implemented using a new infrastructure called "speculative
insertion". It is an optimistic variant of regular insertion that first
does a pre-check for existing tuples and then attempts an insert.  If a
violating tuple was inserted concurrently, the speculatively inserted
tuple is deleted and a new attempt is made.  If the pre-check finds a
matching tuple the alternative DO NOTHING or DO UPDATE action is taken.
If the insertion succeeds without detecting a conflict, the tuple is
deemed inserted.

To handle the possible ambiguity between the excluded alias and a table
named excluded, and for convenience with long relation names, INSERT
INTO now can alias its target table.

Bumps catversion as stored rules change.

Author: Peter Geoghegan, with significant contributions from Heikki
    Linnakangas and Andres Freund. Testing infrastructure by Jeff Janes.
Reviewed-By: Heikki Linnakangas, Andres Freund, Robert Haas, Simon Riggs,
    Dean Rasheed, Stephen Frost and many others.
2015-05-08 05:43:10 +02:00
..
adminpack
auth_delay
auto_explain
btree_gin btree_gin: properly call DirectFunctionCall1() 2015-03-31 10:26:45 -04:00
btree_gist Define integer limits independently from the system definitions. 2015-04-02 17:43:35 +02:00
chkpass Avoid returning undefined bytes in chkpass_in(). 2015-02-14 12:20:56 -05:00
citext Fix incorrect declaration of citext's regexp_matches() functions. 2015-05-05 15:51:22 -04:00
cube Tweak __attribute__-wrapping macros for better pgindent results. 2015-03-26 14:03:25 -04:00
dblink
dict_int
dict_xsyn
earthdistance Improve speed of make check-world 2015-04-23 08:59:52 -04:00
file_fdw Allow foreign tables to participate in inheritance. 2015-03-22 13:53:21 -04:00
fuzzystrmatch
hstore Reorganize our CRC source files again. 2015-04-14 17:03:42 +03:00
hstore_plperl Enable transforms modules to build and run with Mingw builds. 2015-05-03 09:10:47 -04:00
hstore_plpython hstore_plpython: Support tests on Python 2.3 2015-05-04 22:30:21 -04:00
intagg
intarray Centralize definition of integer limits. 2015-03-25 22:39:42 +01:00
isn
lo
ltree Reorganize our CRC source files again. 2015-04-14 17:03:42 +03:00
ltree_plpython Enable transforms modules to build and run with Mingw builds. 2015-05-03 09:10:47 -04:00
oid2name
pageinspect Improve BRIN infra, minmax opclass and regression test 2015-05-07 13:02:22 -03:00
passwordcheck
pg_buffercache
pg_freespacemap
pg_prewarm
pg_standby
pg_stat_statements Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE. 2015-05-08 05:43:10 +02:00
pg_trgm Reorganize our CRC source files again. 2015-04-14 17:03:42 +03:00
pgcrypto Tweak __attribute__-wrapping macros for better pgindent results. 2015-03-26 14:03:25 -04:00
pgrowlocks Optimize locking a tuple already locked by another subxact 2015-04-10 13:47:15 -03:00
pgstattuple
postgres_fdw Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE. 2015-05-08 05:43:10 +02:00
seg Tweak __attribute__-wrapping macros for better pgindent results. 2015-03-26 14:03:25 -04:00
sepgsql Represent columns requiring insert and update privileges indentently. 2015-05-08 00:20:46 +02:00
spi Use FLEXIBLE_ARRAY_MEMBER in a number of other places. 2015-02-21 16:12:14 -05:00
sslinfo
start-scripts Fix typo in linux startup script. 2015-04-26 09:43:15 -04:00
tablefunc
tcn
test_decoding Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE. 2015-05-08 05:43:10 +02:00
tsearch2
unaccent
uuid-ossp
vacuumlo
xml2
contrib-global.mk
Makefile Add transforms feature 2015-04-26 10:33:14 -04:00
README

The PostgreSQL contrib tree
---------------------------

This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree.  This does not preclude their
usefulness.

User documentation for each module appears in the main SGML
documentation.

When building from the source distribution, these modules are not
built automatically, unless you build the "world" target.  You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.

Some directories supply new user-defined functions, operators, or
types.  To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command.  In a fresh database,
you can simply do

    CREATE EXTENSION module_name;

See the PostgreSQL documentation for more information about this
procedure.