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 1tLvmk-000TrZ-JD for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Dec 2024 02:52:10 +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 1tLvmh-00H7mi-K9 for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Dec 2024 02:52:08 +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 1tLvmh-00H7ma-9u for pgsql-hackers@lists.postgresql.org; Fri, 13 Dec 2024 02:52:08 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tLvmf-002XwD-ST for pgsql-hackers@postgresql.org; Fri, 13 Dec 2024 02:52:07 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-725ea1e19f0so1054787b3a.3 for ; Thu, 12 Dec 2024 18:52:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734058323; x=1734663123; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=3Zrx/RJLF/B5JJL26PqyK+Cd8csv0oaTBrF0NVYx0To=; b=gZOrASdEhojtOwznP0UTZGkC+dVUlRUHaX95VBheZWChMOnif3MwsbHnXrmEM7Ryc/ oWHp8Z+aa/FF60uUDhfm6GFp4bNb+TNoI63C8nqwAPowtLU/BsgkEl2w0w8kKwOVzc0q fmoPssyxyAp0QFX1Nh6mvtqr00UofrSd0Xw0NOSHgNyReFcroOC4L7DUiYnljHRyb6RL +t6GcLdJfyknCozJWTwyTWjW75HYixey9vkdUhcCgLy1i2d0T+TwwGIhe6agQdk8Pv43 QJzBaxo29I4+kus213Mp4QOY7xhWQH6MXx/XhpV4l58273PfocZm63SMIWul78miphai 2qfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734058323; x=1734663123; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3Zrx/RJLF/B5JJL26PqyK+Cd8csv0oaTBrF0NVYx0To=; b=Hb3MeOjVuiDW21v/mV3yf1xtFUiQHnfKnhmQo1bdkdQBzJM+1Nx0RKZhMiwdTLNzs+ W81B/lOLZLaI1Gsq/qP3C3oQZTuxAtd69c2A3MbawTSkm9NTazYEfPPW056gkKG+VPNH fr6X2gQbzJSzHpHwylpgOaAqrGb46FZFTBdiSMHjrbrvxzytQ+eqhl4TRRUt5JbQmPUJ CIy9dHwLyuc9zuDFzZRg2OcuZB4xQDuhUcW81Csw9mkbt4NOLUh3dYGU87FKiHZCt84q 2MI4vXpVTIChJM1irsaU99pI+VcTlaxUAYKOBD2B9g69hYPGSuqXn1Ln5FwX7R1sWX/p VVvw== X-Forwarded-Encrypted: i=1; AJvYcCVqagp9tVcD/SKaYj3t52kplAaSBJa2LmI4fJ/q6DaEVX6rVCEV2R+/D6g/U73kuUuCiKgteeupj2Jf7dmx@postgresql.org X-Gm-Message-State: AOJu0YzAyEP8plH4+/E6JfNIVacp25KYJbCvg909i7oWEK64h1S6IOV6 RNLmfs5xuPRecXEiVyp6sIJFdGOrxAOV8XyyraIO216ZuQclG/MZ X-Gm-Gg: ASbGncuuZBzZro1W9opldc3B1TjoCREw5UhjD0KANsdbLtL6Ss9te37sVLlHFVMrmum pebgwbwctAofq4te+yvOLkowheNAiFhlJ0Xmbmix7facm44AxskWg+qCcD8WMs4DQRUC985pfw3 bP99q41W6cSMSceInaIF68jvxTkofZstfDAmnIPBo8DC69EkPiFbHyh73+/Kp9vSpzDohC3m+W2 cuzKCYaEaROsdr9tzWAu9Cyq3uSzuFn1BhrEzYatj8tqHqaXusrX/4NYiJXhNohb7O2E4e5rclD /wguU+5nZL2pB+Lls4iO2jGoXNJY1PWq X-Google-Smtp-Source: AGHT+IHP96CfvzXIySbCX8V4W0PG6CErsSitoRFg0pGIlvXbZffVchByr9PhX2nGSERw4ZpsIvhuRA== X-Received: by 2002:a05:6a20:7285:b0:1e1:c26d:d7fd with SMTP id adf61e73a8af0-1e1dfe0099fmr1647766637.37.1734058323421; Thu, 12 Dec 2024 18:52:03 -0800 (PST) Received: from [10.10.20.106] (node-og6.pool-125-26.dynamic.totinternet.net. [125.26.123.198]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-725f0e81fc8sm7525824b3a.53.2024.12.12.18.52.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Dec 2024 18:52:02 -0800 (PST) Message-ID: <8b81a3c0-761f-4cfb-97c6-68819fe4d282@gmail.com> Date: Fri, 13 Dec 2024 09:51:58 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add Postgres module info To: Yurii Rashkovskii Cc: Tom Lane , PostgreSQL-development References: <506788.1733941263@sss.pgh.pa.us> <2c215c98-f713-4c5b-b21a-a4b8fa41890b@gmail.com> <556341.1733967371@sss.pgh.pa.us> <0844622e-9967-409a-8038-470a36f1039c@gmail.com> Content-Language: en-AU From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/12/24 21:02, Yurii Rashkovskii wrote: > On Thu, Dec 12, 2024 at 3:41 PM Andrei Lepikhov > wrote: > > On 12/12/24 08:36, Tom Lane wrote: > > Andrei Lepikhov > > writes: > >> It makes sense. But I want to clarify that I avoided changing > >> PG_MODULE_MAGIC because the newly introduced structure has a totally > >> different purpose and usage logic: the struct is designed to check > >> compatibility, but module info isn't connected to the core > version at > >> all: a single version of the code may be built for multiple PG > versions. > >> At the same time, various versions of the same library may be usable > >> with the same core. > > > > Surely.  But I don't see a need for two separately-looked-up > > physical structures.  Seems to me it's sufficient to put the > > ABI-checking fields into a sub-struct within the magic block. > Okay, I've rewritten the patch to understand how it works. It seems to > work pretty well. I added separate fields for minor and major versions. > > > I am keenly interested in helping in this area; as you have mentioned, > I've done similar work using an extension. > > Some thoughts/questions: > > 1. Do we need to latch onto the "magic" structure here? Have we > considered an opportunity to create a separate metadata slot that looks > something like `PG_MODULE_INFO(.version = ...)`. My impression of module > magic was that it should rather be populated during the build – to > provide build-time information. MODULE_INFO would be a rather > informational section supplied by the developer. It has already been debated above. I may agree with colleagues that maintainer-provided information should be stored in the magic field to reduce noise. At the same time, we use a single code part to load all that data into the DynamicFileList. That looks pretty well, isn't it? > > 2. Any reasons to dictate MAJ.MIN format? With semantic versioning > abound, it's rather common to use MAJ.MIN.PATCH. There are also other > extensions to it (like pre-releases, builds, etc.). All of these > indicate distinct versions. The differences between them can be figured > out using semver or other parsers. Pure PL/pgSQL implementations of that > exist [1]. Okay, thanks; that's a good catch. I wonder how to follow these rules with a static fixed-sized structure. I would like to read about any suggestions and implementation examples. > > 3. In my work, I also introduced the concept of stable module identity – > a unique string (for example, UUID) that represents the identity of the > module even if its name is going to change. Admittedly, this is not _the > most common_ type of problem, but I anticipate it becoming more of an > issue with the growth of the extension ecosystem, potential name > clashes, and renamings. With this approach, developers assign this > unique string to a module once at the beginning and never change it. > Have you considered this? This option just needs some live examples. I think, if necessary, it could be added later. -- regards, Andrei Lepikhov