From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: remove unnecessary table_open/close from makeArrayTypeName
Date: Wed, 18 Dec 2019 19:13:26 -0300
Message-ID: <20191218221326.GA25537@alvherre.pgsql> (raw)
Commit bc8036fc666a (12 years ago) seems to have introduced an
unnecessary catalog heap_open/close in order to do syscache accesses.
I presume a preliminary version of the patch used sysscans or something.
I don't think that's necessary, so this patch removes it.
(I noticed while reading Paul Jungwirth's patch that changes how this
works.)
--
Álvaro Herrera Developer, https://www.PostgreSQL.org/Attachments:dont-open.patch (text/x-diff, 810B) downloaddiff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.cindex a8c1de511f..53bd8d104c 100644--- a/src/backend/catalog/pg_type.c+++ b/src/backend/catalog/pg_type.c@@ -785,14 +785,12 @@ makeArrayTypeName(const char *typeName, Oid typeNamespace)
{
char *arr = (char *) palloc(NAMEDATALEN);
int namelen = strlen(typeName);
- Relation pg_type_desc;
int i;
/*
* The idea is to prepend underscores as needed until we make a name that
* doesn't collide with anything...
*/
- pg_type_desc = table_open(TypeRelationId, AccessShareLock);
for (i = 1; i < NAMEDATALEN - 1; i++)
{
@@ -810,7 +808,6 @@ makeArrayTypeName(const char *typeName, Oid typeNamespace)
break;
}
- table_close(pg_type_desc, AccessShareLock);
if (i >= NAMEDATALEN - 1)
ereport(ERROR,
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: alvherre@2ndquadrant.com
Subject: Re: remove unnecessary table_open/close from makeArrayTypeName
In-Reply-To: <20191218221326.GA25537@alvherre.pgsql>
References: <20191218221326.GA25537@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox