Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tJij9-004mMk-Qe for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Dec 2024 00:31:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tJij6-00EWlx-Pi for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Dec 2024 00:31:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tJij6-00EWlo-BC for pgsql-hackers@lists.postgresql.org; Sat, 07 Dec 2024 00:31:17 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tJij4-001QTv-MQ for pgsql-hackers@postgresql.org; Sat, 07 Dec 2024 00:31:16 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-21628b3fe7dso4168015ad.3 for ; Fri, 06 Dec 2024 16:31:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1733531473; x=1734136273; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:date:to:from :subject:message-id:from:to:cc:subject:date:message-id:reply-to; bh=zYbKG6+YlrrOh23bnl983qTN4EXa3xr7pe/BvO4lu6c=; b=Ff+rqsVEc+/xm+Fl8qwy55lNvw42L+NT7E78gqHTzYe8gmtvrpLXNxCYCaxUT+hwMt uvvm5iCY5t0aVWZuk2Zs5sWAvlKhb1+5rheVYwh7UIhqpe90eGDucEHZClgcith0zYxC GYsROSliLF1cQQF5aEgIyA0R5KnNKIUSMUaQtkZnZtA8ViIJ1i1CCKyar7oC7dBQjVzA Sn6DAq1XrYjFtj1nDLXUx7nh06Hbi5yVT7LfB42RDKQQo79jOAnrwElzQW0aPc348UtO WYBsfvuNxrT6WVCU/Z3RYMsTkJOJNShP0IdxdVn/z0qLPnJeL43Gyv5iU3z+dBQh8qER EJcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733531473; x=1734136273; h=mime-version:user-agent:content-transfer-encoding:date:to:from :subject:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zYbKG6+YlrrOh23bnl983qTN4EXa3xr7pe/BvO4lu6c=; b=ASsiypnYToutPvhhekVcs3n1XFt+h+Q91PGZ7MA3QIp25SK+HsFEjkrL8isazpdy6C AFF2t99kE49O53YgMvKpI18W5HN9UCl0DnL68BN6Hf5AxJ+hDsfHfSPuG/iNpBf8LYJ6 0no2q7MzI3xIG8cDootmhmJFP+cnOjAkptjy0/DtfrDBVKIG9ciO1T7uQeAnrH6girUP zdFzztMMSyNdrfs6CaDmJLEqFBnK4s09VtLgFIcRDcPP4DlogHxF2A/upo/HDlYkpVwH 9Y2ZcrzinG3y9utTiYpUX6Nhtmx7PD1ltzDLQYirHbXnc02g3OJyuVXp8GyagUwCjxy0 RxSw== X-Gm-Message-State: AOJu0YyMh6ywQFEycGNS9+9C77Jc/8zF70d0isobNX0pzrODjX7vbQXA rQQNivWIsq+fauI86mBCb0niKDlIAU959VvGvf/uD30o2DjrfD9OboPF0TgUlzGOp4guFfYHi0E = X-Gm-Gg: ASbGnctvl6OZJ28fM7GOCldhlllQdocKjG9fLU1HVMK3+ig0G7SHq+yPucXBGBYagwu FGyQcKxr2kFrAcytEFfvO3Oact7x08H9OAm1zh+REBehVGa8zaUDRKDmtpLOqQhn5DFxQe9OYBk DJ+9B70wYw2eBwTnDv3dh+tcdlh5zEbAVQm+puuph1gq7IONUwhz4zFIBd+Bgokc1iTQbK7C5Sf r4j/itJomAVBn9I4L+f2jS7BqaVdZ+RLgtMCmfKoACcOFfXqg7/tzxlA4DxkwsxC1qoVDMJeqfC jHW34APycI24v8pc X-Google-Smtp-Source: AGHT+IGvB5xTXNrXJy+o8I3wdLkyqFIdP4kurLkwIMeF7NrugooDEIh6+UXycHFd1Kc6awZ8xj4gXw== X-Received: by 2002:a17:903:24d:b0:216:1367:7e3d with SMTP id d9443c01a7336-21614d67fc3mr75872995ad.31.1733531473047; Fri, 06 Dec 2024 16:31:13 -0800 (PST) Received: from jeff-laptop.lan (c-76-102-242-158.hsd1.ca.comcast.net. [76.102.242.158]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21613079c56sm18907375ad.27.2024.12.06.16.31.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 16:31:12 -0800 (PST) Message-ID: <8f8d06fbf986437b1526c6ac68a27165cf4deea3.camel@j-davis.com> Subject: inconsistent use of SearchSysCacheCopy From: Jeff Davis To: pgsql-hackers@postgresql.org Date: Fri, 06 Dec 2024 16:31:11 -0800 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk When modifying catalog contents, some callers use SearchSysCacheN() and some use SearchSysCacheCopyN(). for instance, these callers use SearchSysCacheN(): - AggregateCreate() - ProcedureCreate() while these callers that use SearchSysCacheCopyN(): - OperatorCreate() - TypeCreate() I generally thought that the non-copy variant was preferred if you are using heap_modify_tuple() or similar, and the latter used when necessary (e.g. modifying through the Form_pg_foo pointer). Aside from avoiding a needless copy, the non-copy variant is also a bit safer because you'll get a WARNING if you forget to ReleaseSysCache(). On the other hand, if you don't use the copy variant, and you actually do modify it, that would be quite dangerous; so perhaps that's why the copy variants are used in so many places where it seems unnecessary. Is there a preferred convention? Regards, Jeff Davis