Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihhZk-0006EJ-K6 for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Dec 2019 22:13:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ihhZj-0002JS-6r for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Dec 2019 22:13:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihhZi-0002FE-LE for pgsql-hackers@lists.postgresql.org; Wed, 18 Dec 2019 22:13:46 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ihhZc-0004VV-19 for pgsql-hackers@lists.postgresql.org; Wed, 18 Dec 2019 22:13:45 +0000 Received: by mail-pf1-x433.google.com with SMTP id x185so1992617pfc.5 for ; Wed, 18 Dec 2019 14:13:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :content-transfer-encoding:user-agent; bh=iUVe6fvsyfGygLYkPqFO3RCQ9YUN+Me5HJZXwhghdok=; b=RnQTc8QI+8ikoiHCDPPACYYDUeQv9KA8GfRa4pQowVk77/1UD1oTLMdiWxikLQoOnt 9/QhPYdbY07z8fC287rAwD8zBjA6x6+5i0sgugmIN0bn7NVYCd/rseMx19e9cCtF7Dgh nuKlCwErLwU9OaRfNlBTPkWuMawor0gKcamGTS2uzUoheEBJ+zG2F842mGQZjIGIu2eg Rey5BuQgobRIhSafYQ9GbNuDS9yTXOHtxaPsPse+s3oE7Q2mYtVGkzy1W7tpw/CjKuUQ 9nV/iBFQuLIvjqGvFgiJH+4ZutQ30UYrlTeygRTf/TGOaTIgE8CeoUBdMBA3X8G6HSeO GPzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=iUVe6fvsyfGygLYkPqFO3RCQ9YUN+Me5HJZXwhghdok=; b=chkFJgyk9VEvhKGcpo9lEB58NYAWmXbo2dhoeF5a0PAz2YmS2fDn87z/kOGWKuwKOc 3hJHMNbrUHjIYfNEQXEAGTfIkbhopfe88YK+AkFlw4ldk5bSP7Ew7CwZzIyBTrjMgD4E xLjx5l5eD+9vzPIfMxmPBKiOnuojLBbFMHe1gy+UmrokYtZK4qATBzzNoxOTEjNKcTd5 jKEHEc+sJ35bjlpLM9SwGsgim6Bovd2Ugh89lNa3px1z9yfGvTPrDwS6y3u5Hocdausf kZ7/GNcAoTyp2Qwepw5MnAIdH6VWPfzV3JAYd0fd/KwVX5J+dSlpdualdDTvgwfie5T6 Vu7A== X-Gm-Message-State: APjAAAU62r2qZFJiaXX0Ct+fqMKMMVcoK79syWt0qmarrqLOxsTxzQfG VpcpG1yEaqQYarh2ITOOuoWD5H17qPGhZiG5jY1xPjZLEi7O9nyAJAtXsd1elC6YA2fD2bXCmu8 nSX89HxKuEt8NPGYQu3BQ9X11Q/yI3TRBwEgo0L5m8fryG0av+dUj8QTjLNE8PXuWVSSI0feV6f Y6DJ8DZNxxyu1goxGX X-Google-Smtp-Source: APXvYqxSbqWZX0gRO333cNijol0owhhy1/W3sfK1vd91wmKqfORblwi6L9pJRW/4Mtqc6hfwi0sgCw== X-Received: by 2002:a62:f842:: with SMTP id c2mr5687690pfm.104.1576707217970; Wed, 18 Dec 2019 14:13:37 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([179.56.51.67]) by smtp.gmail.com with ESMTPSA id d65sm4680606pfa.159.2019.12.18.14.13.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 14:13:37 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 63B10300A48; Wed, 18 Dec 2019 19:13:26 -0300 (-03) Date: Wed, 18 Dec 2019 19:13:26 -0300 From: Alvaro Herrera To: Pg Hackers Subject: remove unnecessary table_open/close from makeArrayTypeName Message-ID: <20191218221326.GA25537@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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/ --EVF5PPMfhYS0aIcm Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="dont-open.patch" diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c index 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, --EVF5PPMfhYS0aIcm--