postgres/contrib
Masahiko Sawada 4bea91f21f Support COPY TO for partitioned tables.
Previously, COPY TO command didn't support directly specifying
partitioned tables so users had to use COPY (SELECT ...) TO variant.

This commit adds direct COPY TO support for partitioned
tables, improving both usability and performance. Performance tests
show it's faster than the COPY (SELECT ...) TO variant as it avoids
the overheads of query processing and sending results to the COPY TO
command.

When used with partitioned tables, COPY TO copies the same rows as
SELECT * FROM table. Row-level security policies of the partitioned
table are applied in the same way as when executing COPY TO on a plain
table.

Author: jian he <jian.universality@gmail.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Melih Mutlu <m.melihmutlu@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CACJufxEZt%2BG19Ors3bQUq-42-61__C%3Dy5k2wk%3DsHEFRusu7%3DiQ%40mail.gmail.com
2025-10-20 10:38:52 -07:00
..
amcheck Improve TAP tests by replacing ok() with better Test::More functions 2025-10-17 14:39:09 +09:00
auth_delay Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
auto_explain Allow resetting unknown custom GUCs with reserved prefixes. 2025-08-01 16:52:11 -05:00
basebackup_to_shell meson: Increase minimum version to 0.57.2 2025-07-02 11:14:53 +02:00
basic_archive Remove translation marker from libpq-be-fe-helpers.h. 2025-07-22 22:08:36 +09:00
bloom Remove unneeded casts of BufferGetPage() result 2025-08-29 07:18:29 +02:00
bool_plperl Fix erroneous construction of functions' dependencies on transforms. 2025-04-07 13:31:37 -04:00
btree_gin Add more cross-type comparisons to contrib/btree_gin. 2025-07-03 16:30:38 -04:00
btree_gist Do a tiny bit of header file maintenance 2025-09-30 12:28:29 +02:00
citext Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
cube Allow redeclaration of typedef yyscan_t 2025-09-12 08:16:00 +02:00
dblink dblink: Avoid locking relation before privilege check. 2025-10-14 12:20:48 -05:00
dict_int Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
dict_xsyn Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
earthdistance Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
file_fdw Keep track of what RTIs a Result node is scanning. 2025-09-23 09:07:55 -04:00
fuzzystrmatch Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
hstore Fix varatt versus Datum type confusions 2025-08-05 12:11:36 +02:00
hstore_plperl Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
hstore_plpython Remove circular #include's between plpython.h and plpy_util.h. 2025-04-27 11:43:02 -04:00
intagg Update copyright for 2025 2025-01-01 11:21:55 -05:00
intarray Track the maximum possible frequency of non-MCE array elements. 2025-09-20 14:48:16 -04:00
isn Fix various incorrect filename references 2025-09-22 13:33:17 +12:00
jsonb_plperl Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
jsonb_plpython Remove circular #include's between plpython.h and plpy_util.h. 2025-04-27 11:43:02 -04:00
lo Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
ltree Mop-up for Datum conversion cleanups. 2025-08-08 18:44:57 -04:00
ltree_plpython Remove circular #include's between plpython.h and plpy_util.h. 2025-04-27 11:43:02 -04:00
oid2name Update copyright for 2025 2025-01-01 11:21:55 -05:00
pageinspect Don't include access/htup_details.h in executor/tuptable.h 2025-10-05 18:00:38 +02:00
passwordcheck Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
pg_buffercache Add CHECK_FOR_INTERRUPTS in contrib/pg_buffercache functions. 2025-08-19 12:11:42 -07:00
pg_freespacemap Prevent assertion failure in contrib/pg_freespacemap. 2025-03-27 13:20:23 -04:00
pg_logicalinspect Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
pg_overexplain Keep track of what RTIs a Result node is scanning. 2025-09-23 09:07:55 -04:00
pg_prewarm Allow role created by new test to log in on Windows. 2025-10-18 18:36:21 -04:00
pg_stat_statements Add ExplainState argument to pg_plan_query() and planner(). 2025-10-08 08:33:29 -04:00
pg_surgery Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
pg_trgm Put "excludeOnly" GIN scan keys at the end of the scankey array. 2025-08-26 12:08:57 -04:00
pg_visibility Improve TAP tests by replacing ok() with better Test::More functions 2025-10-17 14:39:09 +09:00
pg_walinspect Don't include access/htup_details.h in executor/tuptable.h 2025-10-05 18:00:38 +02:00
pgcrypto Revert "Make some use of anonymous unions [pgcrypto]" 2025-09-30 13:12:16 +02:00
pgrowlocks Add missing Datum conversions 2025-08-08 22:06:57 +02:00
pgstattuple pgstattuple: Improve reports generated for indexes (hash, gist, btree) 2025-10-02 11:07:30 +09:00
postgres_fdw Support COPY TO for partitioned tables. 2025-10-20 10:38:52 -07:00
seg Allow redeclaration of typedef yyscan_t 2025-09-12 08:16:00 +02:00
sepgsql Avoid including commands/dbcommands.h in so many places 2025-08-28 12:39:04 +02:00
spi Use pg_ascii_tolower()/pg_ascii_toupper() where appropriate. 2025-07-01 07:24:23 -07:00
sslinfo Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
start-scripts Remove gratuitous references to postmaster program 2023-01-26 10:48:32 +01:00
tablefunc Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
tcn Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
test_decoding Add mem_exceeded_count column to pg_stat_replication_slots. 2025-10-08 10:05:04 -07:00
tsm_system_rows Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
tsm_system_time Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
unaccent Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
uuid-ossp Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
vacuumlo Update copyright for 2025 2025-01-01 11:21:55 -05:00
xml2 Don't include access/htup_details.h in executor/tuptable.h 2025-10-05 18:00:38 +02:00
contrib-global.mk Respect TEMP_CONFIG when pg_regress_check and friends are called 2016-02-27 12:28:21 -05:00
Makefile pg_overexplain: Additional EXPLAIN options for debugging. 2025-03-26 13:52:21 -04:00
meson.build pg_overexplain: Additional EXPLAIN options for debugging. 2025-03-26 13:52:21 -04:00
README Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00

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.