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 1t4ExA-00H87N-SX for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Oct 2024 07:41:49 +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 1t4Ex8-00Dlty-VU for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Oct 2024 07:41:47 +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 1t4Ex8-00DltU-Gi for pgsql-hackers@lists.postgresql.org; Fri, 25 Oct 2024 07:41:47 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t4Ex6-002l1U-0O for pgsql-hackers@lists.postgresql.org; Fri, 25 Oct 2024 07:41:45 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-539f2b95775so1992697e87.1 for ; Fri, 25 Oct 2024 00:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=cybertec.at; t=1729842102; x=1730446902; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=Too/vT67ScVB5rmyMb6XYY2S34nf5MwCQDX9uK5dK7g=; b=CaAzelO4ZN/x5JyMCXcXvp17oAOQjVuqm/qAiC+bP9Yqyyb2t2y4qB3YPOR6EqcS4S O/FcyjGq8Qogm5bTlCjrUp6CcX2GGtukyqoTuBr2LhP0qdIME27usw3pA+1mRoFLSESq kywQ8XJvk4U9Q7u1G8Av+BTZkEe+Ln/u8Et18= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729842102; x=1730446902; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Too/vT67ScVB5rmyMb6XYY2S34nf5MwCQDX9uK5dK7g=; b=MxxB4pTjYOIy5sJnf64E9BKL/s/WNn7IBczmb8erAa0cLA8U/R4zuTBKFHw+8bkneR UwCAVkp7CQWUpfSoy03JPCcHXpNgdTUkcRH3WldcyeqLd7Dav7XeGIvK3Qv3Jm+s7wRu wPg313+gmZAy5GlcIkEe6qHZSHfFdk9FnTU/hZUvTnvxCLOVqxx4WqPTf4QUp9HUEJ2h ThivOm+q0wFC8zH3qZgXVmqyrKTl1SxfFEU07yDXU+yN8BzmPhMVqvdYLQAQOA5nkkeZ QLjHY3Uncd6yq3gKIqXP0VhfVDJPMXSPPsMPnrhNbTivk31UB9XL+K4r8LENbZdEpGST +tsQ== X-Forwarded-Encrypted: i=1; AJvYcCXbb7YLcRh3CBlWo66LHLxIPulBEpUX53oNzLpckccI9zk0C3wntZftg9TbXmVSKxE49GvfAKqNuXNvbfCj@lists.postgresql.org X-Gm-Message-State: AOJu0YwhnrTAhh9/byjB4yVSlgFQKsPijDqYz+0uEoL1qdsnl7SxvzCf Ju7KRs0AdzmRd1Z8Eu2swmNaWnUmyqghe5wM2Ly9cnSZjbZUi+kBW8BetP5ydEQ= X-Google-Smtp-Source: AGHT+IFupm/i3MzcI9Z65Nc4yEyabsji52k/0s4FNf2taAOsA/Y1VPlpW4nWWnvzFnnXwEr5YzqbfQ== X-Received: by 2002:ac2:4bcd:0:b0:53b:1fd1:df34 with SMTP id 2adb3069b0e04-53b1fd1e057mr7156381e87.45.1729842102144; Fri, 25 Oct 2024 00:41:42 -0700 (PDT) Received: from localhost.localdomain (86.73.73.85.static.otenet.gr. [85.73.73.86]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f297a29sm38016166b.132.2024.10.25.00.41.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 00:41:41 -0700 (PDT) Message-ID: <986faf36db4ebdcbe8397e2c15bb691dbe631ec8.camel@cybertec.at> Subject: Re: proposal: schema variables From: Laurenz Albe To: Pavel Stehule Cc: Erik Rijkers , Michael Paquier , Amit Kapila , DUVAL REMI , PostgreSQL Hackers Date: Fri, 25 Oct 2024 10:41:40 +0300 In-Reply-To: References: <20200924035637.GF28585@paquier.xyz> <20201001033824.GC8130@paquier.xyz> <51a9a68e8a998d04df17417d45c1dbd4@xs4all.nl> <89817942c99da01cd5e7850fe418436b@xs4all.nl> <56ca532c37eb0b540961f74a7bd5db39@xs4all.nl> <8181bd3abc647bdae5a4f78e71e62478a98c75f4.camel@cybertec.at> <9e67d49deb18270eddb95e602c83f02b98459843.camel@cybertec.at> <3b662dc5b615d4c20a55e8e2fbe6fc00fe00609d.camel@cybertec.at> <6996931e8c9edf3b82223e74e92326a7ed06c1d6.camel@cybertec.at> <67aa68a7e6dfb44c0cbbdf7f97cadfede4269ce5.camel@cybertec.at> <04ec666686e9e21cb515617df06885c66f3d34ce.camel@cybertec.at> <3850a85012d040827b10193189edbe2c23a64f8f.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.4 (3.52.4-2.fc40) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2024-10-25 at 07:21 +0200, Pavel Stehule wrote: > > > +=C2=A0 =C2=A0 =C2=A0elog(DEBUG1, "pg_session_variables start"); > >=20 > > I don't think that message is necessary, particularly with DEBUG1. > > I have removed this message and the "end" message as well. >=20 > removed Thanks. > > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0memset(values, 0, sizeof(values)); > > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0memset(nulls, 0, sizeof(nulls)); > >=20 > > Instead of explicitly zeroing out the arrays, I have used an empty init= ializer > > in the definition, like > >=20 > > =C2=A0 bool=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nulls[NUM_PG_SESSION_VARI= ABLES_ATTS] =3D {}; > >=20 > > That should have the same effect. > > If you don't like that, I have no real problem with your original code. >=20 > I prefer the original way - minimally it is a common pattern. I didn't fi= nd any usage of `=3D {} ` in code That's alright by me. > > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0values[0] =3D ObjectIdGetDatum(svar->varid); > > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0values[3] =3D ObjectIdGetDatum(svar->typid); > >=20 > > You are using the type ID without checking if it exists in the catalog. > > I think that is a bug. >=20 > The original idea was using typid as hint identification of deleted varia= bles. The possibility > that this id will not be consistent for the current catalogue was expecte= d. And it > is a reason why the result type is just Oid and not regtype. Without it, = pg_session_variables > shows just empty rows (except oid) for dropped not yet purged variables. I see your point. It is for testing and debugging only. >=20 > owing typid has some information value, but I don't think it is absolutel= y necessary. I see some possible changes: >=20 > 1. no change > 2. remove typid column > 3. show typid only when variable is valid, and using regtype as output ty= pe, remove typname >=20 > What do you prefer? I'd say leave it as it is. I agree that it is not dangerous, and if it is = intentional that non-existing type IDs might be displayed, I have no problem with it. Yours, Laurenz Albe