postgresql/src/backend/commands
Tom Lane 131ea3e908 Fix plancache refcount leak after error in ExecuteQuery.
When stuffing a plan from the plancache into a Portal, one is
not supposed to risk throwing an error between GetCachedPlan and
PortalDefineQuery; if that happens, the plan refcount incremented
by GetCachedPlan will be leaked.  I managed to break this rule
while refactoring code in 9dbf2b7d7.  There is no visible
consequence other than some memory leakage, and since nobody is
very likely to trigger the relevant error conditions many times
in a row, it's not surprising we haven't noticed.  Nonetheless,
it's a bug, so rearrange the order of operations to remove the
hazard.

Noted on the way to looking for a better fix for bug #17053.
This mistake is pretty old, so back-patch to all supported
branches.
2021-06-16 19:30:17 -04:00
..
Makefile Split copy.c into four files. 2020-11-23 10:50:50 +02:00
aggregatecmds.c SQL-standard function body 2021-04-07 21:47:55 +02:00
alter.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
amcmds.c Fix some typos, grammar and style in docs and comments 2021-02-24 16:13:17 +09:00
analyze.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
async.c Remove server and libpq support for old FE/BE protocol version 2. 2021-03-04 10:45:55 +02:00
cluster.c Fix typos and grammar in documentation and code comments 2021-04-09 13:53:07 +09:00
collationcmds.c Revert per-index collation version tracking feature. 2021-05-07 21:10:11 +12:00
comment.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
constraint.c Pass down "logically unchanged index" hint. 2021-01-13 08:11:00 -08:00
conversioncmds.c Add 'noError' argument to encoding conversion functions. 2021-04-01 11:45:22 +03:00
copy.c Rename Default Roles to Predefined Roles 2021-04-01 15:32:06 -04:00
copyfrom.c Fix typos and grammar in documentation and code comments 2021-04-09 13:53:07 +09:00
copyfromparse.c Add heuristic incoming-message-size limits in the server. 2021-04-28 15:50:46 -04:00
copyto.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
createas.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
dbcommands.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
define.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
discard.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
dropcmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
event_trigger.c Improve handling of dropped objects in pg_event_trigger_ddl_commands() 2021-06-14 14:57:22 +09:00
explain.c Allow compute_query_id to be set to 'auto' and make it default 2021-05-15 14:13:09 -04:00
extension.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
foreigncmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
functioncmds.c Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
indexcmds.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
lockcmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
matview.c Reduce risks of conflicts in internal queries of REFRESH MATVIEW CONCURRENTLY 2021-06-03 15:28:24 +09:00
opclasscmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
operatorcmds.c Fix typos in operatorcmds.c 2021-05-10 15:45:54 +09:00
policy.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
portalcmds.c Avoid misbehavior when persisting a non-stable cursor. 2021-06-08 17:50:29 -04:00
prepare.c Fix plancache refcount leak after error in ExecuteQuery. 2021-06-16 19:30:17 -04:00
proclang.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
publicationcmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
schemacmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
seclabel.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
sequence.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
statscmds.c Replace run-time error check with assertion 2021-05-27 09:54:14 +02:00
subscriptioncmds.c Improve SQLSTATE reporting in some replication-related code. 2021-06-16 11:52:05 -04:00
tablecmds.c Rethink definition of pg_attribute.attcompression. 2021-05-27 13:24:27 -04:00
tablespace.c Prevent drop of tablespaces used by partitioned relations 2021-01-14 15:32:14 -03:00
trigger.c Fix access to no-longer-open relcache entry in logical-rep worker. 2021-05-22 21:25:29 -04:00
tsearchcmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
typecmds.c Revert 29854ee8d1 due to buildfarm failures 2021-06-15 21:44:40 +03:00
user.c Standardize pg_authid oid_symbol values. 2021-04-10 12:01:41 -07:00
vacuum.c Improve docs and error messages for parallel vacuum. 2021-05-25 09:26:53 +05:30
variable.c Fix some inappropriately-disallowed uses of ALTER ROLE/DATABASE SET. 2021-04-13 15:10:18 -04:00
view.c Update copyright for 2021 2021-01-02 13:06:25 -05:00