unsafe tuple releasing in get_default_partition_oid

Started by Julien Rouhaudabout 8 years ago3 messages
#1Julien Rouhaud
rjuju123@gmail.com
1 attachment(s)

Hi,

I just noticed that get_default_partition_oid() tries to release the
tuple even if it isn't valid.
Trivial patch attached.

Attachments:

fix_gdpo-v1.difftext/plain; charset=US-ASCII; name=fix_gdpo-v1.diffDownload
diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c
index 07fdf66c38..66ec214e02 100644
--- a/src/backend/catalog/partition.c
+++ b/src/backend/catalog/partition.c
@@ -2831,9 +2831,9 @@ get_default_partition_oid(Oid parentId)
 
 		part_table_form = (Form_pg_partitioned_table) GETSTRUCT(tuple);
 		defaultPartId = part_table_form->partdefid;
+		ReleaseSysCache(tuple);
 	}
 
-	ReleaseSysCache(tuple);
 	return defaultPartId;
 }
 
#2Robert Haas
robertmhaas@gmail.com
In reply to: Julien Rouhaud (#1)
Re: unsafe tuple releasing in get_default_partition_oid

On Sat, Oct 28, 2017 at 10:03 AM, Julien Rouhaud <rjuju123@gmail.com> wrote:

I just noticed that get_default_partition_oid() tries to release the
tuple even if it isn't valid.
Trivial patch attached.

Oops. I wonder how that managed to survive testing.

Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Julien Rouhaud
rjuju123@gmail.com
In reply to: Robert Haas (#2)
Re: unsafe tuple releasing in get_default_partition_oid

On Sat, Oct 28, 2017 at 11:13 AM, Robert Haas <robertmhaas@gmail.com> wrote:

On Sat, Oct 28, 2017 at 10:03 AM, Julien Rouhaud <rjuju123@gmail.com> wrote:

I just noticed that get_default_partition_oid() tries to release the
tuple even if it isn't valid.
Trivial patch attached.

Oops. I wonder how that managed to survive testing.

Committed.

Thanks!

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers