postgresql/contrib/postgres_fdw
Dean Rasheed 80feb727c8 Add OLD/NEW support to RETURNING in DML queries.
This allows the RETURNING list of INSERT/UPDATE/DELETE/MERGE queries
to explicitly return old and new values by using the special aliases
"old" and "new", which are automatically added to the query (if not
already defined) while parsing its RETURNING list, allowing things
like:

  RETURNING old.colname, new.colname, ...

  RETURNING old.*, new.*

Additionally, a new syntax is supported, allowing the names "old" and
"new" to be changed to user-supplied alias names, e.g.:

  RETURNING WITH (OLD AS o, NEW AS n) o.colname, n.colname, ...

This is useful when the names "old" and "new" are already defined,
such as inside trigger functions, allowing backwards compatibility to
be maintained -- the interpretation of any existing queries that
happen to already refer to relations called "old" or "new", or use
those as aliases for other relations, is not changed.

For an INSERT, old values will generally be NULL, and for a DELETE,
new values will generally be NULL, but that may change for an INSERT
with an ON CONFLICT ... DO UPDATE clause, or if a query rewrite rule
changes the command type. Therefore, we put no restrictions on the use
of old and new in any DML queries.

Dean Rasheed, reviewed by Jian He and Jeff Davis.

Discussion: https://postgr.es/m/CAEZATCWx0J0-v=Qjc6gXzR=KtsdvAE7Ow=D=mu50AgOe+pvisQ@mail.gmail.com
2025-01-16 14:57:35 +00:00
..
expected Add OLD/NEW support to RETURNING in DML queries. 2025-01-16 14:57:35 +00:00
sql Add OLD/NEW support to RETURNING in DML queries. 2025-01-16 14:57:35 +00:00
t postgres_fdw: SCRAM authentication pass-through 2025-01-15 17:58:05 +01:00
.gitignore
connection.c Check return of pg_b64_encode() for error 2025-01-16 08:35:57 +01:00
deparse.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
Makefile postgres_fdw: SCRAM authentication pass-through 2025-01-15 17:58:05 +01:00
meson.build postgres_fdw: SCRAM authentication pass-through 2025-01-15 17:58:05 +01:00
option.c postgres_fdw: SCRAM authentication pass-through 2025-01-15 17:58:05 +01:00
postgres_fdw--1.0--1.1.sql
postgres_fdw--1.0.sql
postgres_fdw--1.1--1.2.sql postgres_fdw: Extend postgres_fdw_get_connections to return user name. 2024-09-18 12:51:48 +09:00
postgres_fdw.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
postgres_fdw.control postgres_fdw: Add "used_in_xact" column to postgres_fdw_get_connections(). 2024-07-26 22:15:51 +09:00
postgres_fdw.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
shippable.c Update copyright for 2025 2025-01-01 11:21:55 -05:00