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.96) (envelope-from ) id 1vIY0H-004wlg-1S for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Nov 2025 19:56:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIY0E-002AHZ-2x for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Nov 2025 19:56:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIY0E-002AHR-21 for pgsql-hackers@lists.postgresql.org; Mon, 10 Nov 2025 19:56:38 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vIY0C-0072IT-1C for pgsql-hackers@lists.postgresql.org; Mon, 10 Nov 2025 19:56:38 +0000 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-6419aaced59so1959237a12.0 for ; Mon, 10 Nov 2025 11:56:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762804595; x=1763409395; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Om3M2NfFuC5ANwGT3Yod8tUFk78L7Qh+1iarg8nmVxg=; b=aKqtrKXOOFjWwx/xLH+kuiR5kWkLyu0EtgguhjO+oi3n3R6do6cxXvYOF7+w3kVSxx Vpt8B9Y+YQzFOuiOwPzQ1gPQDqm//wJ7QUM2w50gkFGevRTB1JEtZHx//D9ZSL6RM4hW KK69zznf6TSl21H4J5+QlmjbjP2ltZA1nUCgHhn+Wkq08mQhfUbQ+IcFNSZSoLg7ym8s ixiBhm+EAUsld/RfSIjbeCozIpExPFVbKqvlFuCYLQeSwOlUGLeSijpYeHRXkKZms96P Nge/bxhQ6zhznQtKp7lEA8fD6JCbTf+ljxV+gK2nejfkvJd8eDvMm6GGv5oKak+ZczXT Fbqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762804595; x=1763409395; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Om3M2NfFuC5ANwGT3Yod8tUFk78L7Qh+1iarg8nmVxg=; b=adYOY/KZvljs4YD7/Nwfl2zfKBo2uafLyDQweVmHVogogG6h6fQTh2qKHJnDX6Fh7G avpQA8xsYL8Tg5RiysrUmvWZecAhHqmDUrEfRYy/AHeoXyJkQNj9t3dA8N+URWEPOhlD Vg3evhQEIsq5Tkc1miGDrfsL2yb0ecYqQkDy7H3kdyi5kZIqtPi8Gr1WWtD7mEIwIWtj n2QfmjPJKoIIXE2q4v/DwUOnE4EgumVQDnxjNVXWxI8Ew+6Gz/6n2j5hAgFqna/YefrY AQCeEAHzQpxTbm1xj3i4BP0NsElLKkH5zUwUgAyPD5i0bZu1VA3K+nyODyUAroEZRzRM WOpA== X-Gm-Message-State: AOJu0YzeDHJQVkC2+fWdmF67g2Bbkqcbn0wt2Qzb0aC1ZchqD/sZZmMg uRGVxcabRRnx1czeHnSC101WvPD30Abl9N9eUGioQpisZf+WZpc8zv9yNKiK7kOY+ZXuq6bav22 heZux+JwAdHPjcaKZ0YotaUR7yAHanBrB3WU1UVI= X-Gm-Gg: ASbGncu4fb2dQaltmvFEsSubnL4Zqj9CCcOqqGprN4wU0ERVJvuPDMGV1BL4GZKibPd SQLwISGGGN07e29B2Q5oEcSaXWeLG39PUMNuMER3DpCnbyKexgZqf6DGY/k3Q04iF3NYBak3XMe J54wdHr262HeN953UBXWbRLAL6aptIGEK3STYB235/1mlRFDO2yBDHUjxsh1/1ASr6Uvjh1guOw 1JKJePqME6xd94Sxgzxutfq79OQmPDTEH1e0JdBf9SZi2ARrgWQjmYbR8j2QOuvRA4= X-Google-Smtp-Source: AGHT+IEZaMfIJ7yTQ/pfcqiOlLx+S4VkQ4u0TSnDBn/K7Ri1UQsl/Rgm81wh7aiFJe0OSQvAOoh2316F0weHIsZaLqY= X-Received: by 2002:a05:6402:2816:b0:640:abd5:864d with SMTP id 4fb4d7f45d1cf-6415e6f22bcmr7621047a12.21.1762804594614; Mon, 10 Nov 2025 11:56:34 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sami Imseih Date: Mon, 10 Nov 2025 13:56:23 -0600 X-Gm-Features: AWmQ_bkDPBjVJ7ZGE6eqG5Pl4rVCSHtLFszZgQgGU5YXl9ffiZ7lcyn0Dp8Yo98 Message-ID: Subject: Re: [Proposal] Adding callback support for custom statistics kinds To: Michael Paquier Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > > Hmm. I would like to propose something a bit more flexible, > > refactoring and reusing some of the existing callbacks, among the > > following lines: > > - Rather than introducing a second callback able to do more > > serialization work, let's expand a bit the responsibility of > > to_serialized_name and from_serialized_name to be able to work in a > > more extended way, renaming them to "to/from_serialized_entry", which > > Sure, we can go that route. I started reworking the patch, but then I realized that I don't like this approach of using the same callback to support serializing NameData and serializing extra data. In the existing "to_serialized_name" callback , NameData is serialized instead of the hash key, meaning that the "from_serialized_name" must be called before we create an entry. The callback translates the NameData to an objid as is the case with replication slots, and the key is then used to create the entry. However, in the case of serializing extra data, we want to have already created the entry by the time we call the callback. For example populating non-key fields of an entry with a dsa_pointer after reading some serialized data into dsa. If we do want to support a single callback, we would need extra metadata in the Kind registration to let the extension tell us what the callback is used for and to either trigger the callback before or after entry creation. I am not very thrilled about doing something like this, as I see 2 very different use-cases here. What do you think? -- Sami Imseih Amazon Web Services (AWS)