public inbox for [email protected]  
help / color / mirror / Atom feed
From: jian he <[email protected]>
To: Pavel Stehule <[email protected]>
Cc: Dmitry Dolgov <[email protected]>
Cc: Laurenz Albe <[email protected]>
Cc: Erik Rijkers <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: Amit Kapila <[email protected]>
Cc: DUVAL REMI <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Re: proposal: schema variables
Date: Fri, 7 Feb 2025 21:14:09 +0800
Message-ID: <CACJufxEwd5V82CpGykhKD3Pb9LfS_rgw3-dPrxdT0rwqnkvzQQ@mail.gmail.com> (raw)
In-Reply-To: <CAFj8pRBFxSj0Byt+zGqnHsarQHuYSmxOLX3OhD2DKYkc2odOxg@mail.gmail.com>
References: <CAFj8pRC+hPCc2X88xC=pTJoqmVPApDsageZOMyqaxi5788WxHA@mail.gmail.com>
	<CAFj8pRDJ9cq00VYSHxs6LsoHNWjhYXyWWBtV6UgeWwhs0AHa9A@mail.gmail.com>
	<CAFj8pRBPXTcw_3fpKtgVthV2+9rZGhxitZ40DnAwCrK601TZZg@mail.gmail.com>
	<ndtfl4tsnpkb7m7hwvnmlpsascpgd3a7xvjmjhtxffsbrgygtm@4du6zsmnnwq5>
	<CAFj8pRAu4XvNCGu1751t=2YEqLqTjDA3FavMExm2S0KYQq=DdQ@mail.gmail.com>
	<CAFj8pRAsEoeZv0HEnA8CKgFKDSQ-wYw18Os1vdksWCV7ez2bVw@mail.gmail.com>
	<3chredgnjcmccym2kczawfih226b4ac6co7p6z4jeofevrcosi@mrsxkx2x2c65>
	<CAFj8pRBoWPDTOwn5FmMzc+1qiopw+N04U26nviOdF61fs8A2wQ@mail.gmail.com>
	<stckyvkl4yyzvgjsaawojs3xikke7mmds5bhv7l7qerclywywk@h4v4n43xm6u2>
	<CAFj8pRB_E1GM_YGT-ti4bXka6mhLdAAFeTe+BHgHFYC+qb-76g@mail.gmail.com>
	<[email protected]>
	<CAFj8pRBWqEb8i6WmrF_Xh64=48GtisKijgczMv7HTTpe4GswuA@mail.gmail.com>
	<CAFj8pRAry0esQiHcK=6BwwFKDY0zanug6k07CEQzRPBqZ6iW0Q@mail.gmail.com>
	<CACJufxFNjKrmyEi9SLfPCq4c9GUN+5eoOtbZwBPq9eKoO8REUw@mail.gmail.com>
	<CAFj8pRALQ-j-Dz3R1ivCoXut8LEhN+kSa7U8Gshucdv5zU3AfQ@mail.gmail.com>
	<CACJufxG7LvaNbF8ZSCcxOVUbm9W=KGjD=h_Wk+5imMw4s_2QxA@mail.gmail.com>
	<CAFj8pRBY_2awVdER5piyy_JPqsU1Sgr4HLO-v6C1nUS3dJnang@mail.gmail.com>
	<CACJufxEM=BLEn6YfgGonM7yuXMn7iqQJcH5PnDVbajWKanynfg@mail.gmail.com>
	<CAFj8pRBxA868TpLDe9ofXdpVUNmHY8pzkxrjbZ0obCe0g+YZ-Q@mail.gmail.com>
	<CACJufxEb1prZo4G4BhYym1VqKHaPVUv3SoggTR4uCqgCRY7Q-Q@mail.gmail.com>
	<CAFj8pRDK2heEhQNcwD=tcKpG5YyPu7zOz2jdRW5A5QfoSUEi_g@mail.gmail.com>
	<CACJufxEk16ArmFuTV9VYi6DJaZ+9Jrbt0-u0Zuov7sk-vpg_Dg@mail.gmail.com>
	<CAFj8pRAaoPCc=n_TPpWdOvzEdc96xfJZR8W7PphMLxLbGxAq-Q@mail.gmail.com>
	<CAFj8pRAzFCbTwqjaEvkvB0VBa9ofSEYxnv8wM3pHZTGtrRK0yQ@mail.gmail.com>
	<CACJufxFwxAvJL944UQKwxV1YuM3GQNTbPRQ6LwtioSKBfpMN2A@mail.gmail.com>
	<CAFj8pRAVoWzkx8Y3or-frYwszyLSjxzs9jYTm3rx00qN+21ZHg@mail.gmail.com>
	<CAFj8pRDhpDwWrV7DbwoGz=-i3yesEU1oooYyMErQfjMXKw=pOQ@mail.gmail.com>
	<CACJufxGdRAF=e57W3yd1cTrspB2bucnsr6ZfYY=bs+bfJWdRPw@mail.gmail.com>
	<CACJufxG6tFo1uOtTPoUw0ntzHddahd7EmR37DhsxMXxUixPaeQ@mail.gmail.com>
	<CACJufxG7Mc2PK2B7+vkdDxvrsJNN3r+cpzvAFTZZXKnWZOcG6w@mail.gmail.com>
	<CAFj8pRAF8W6Sn91UH9gPtOV4ss99D0et+yvnQf=v0n=85KhWXQ@mail.gmail.com>
	<CAFj8pRD67R73TcbN9sShbKLdtoLGRsM8GJVC_OqY=EWe3sJ1xw@mail.gmail.com>
	<CACJufxHvmagrYNO8rjAd85c8aHzs3cZpiPBiyBjNDUK8GaA6Zg@mail.gmail.com>
	<CAFj8pRDtxmQ62FfRBxdTkLwFiGJeRcgSNaRFc+whRbBG3gHb3w@mail.gmail.com>
	<CACJufxGgOjRcAGw83grK=EcBbjHGOxUYEKKzquz8bWjKJ0aBwQ@mail.gmail.com>
	<CAFj8pRBf4DO5yaWe8Md5v+PtOE3ZB=6yjO16eRt7Nn4uXJ56gQ@mail.gmail.com>
	<CAFj8pRDTacMXb+UpQSCjwROoQWb0vaujCnXhtOvbx_2hTXgLbA@mail.gmail.com>
	<CAFj8pRChgOLa2i0PVu-Zoss4q8k1ojPu_Ax-CksTkOWDTye9pQ@mail.gmail.com>
	<CAFj8pRCpAV5N9q5q+JenC=MWup2gVCWi7ZkOM4F2mbUT=Bp4UQ@mail.gmail.com>
	<CAFj8pRCwddC_o1FMyp_mMCyzzuvU7a0f+1X3tHRKmaFhK2K7jw@mail.gmail.com>
	<CACJufxH2M-tAXTqpttS=f96xfAqj3jVO1BxworB+jyrujR=PPA@mail.gmail.com>
	<CAFj8pRBFxSj0Byt+zGqnHsarQHuYSmxOLX3OhD2DKYkc2odOxg@mail.gmail.com>

On Fri, Feb 7, 2025 at 3:25 PM Pavel Stehule <[email protected]> wrote:
>

Hi
The following review is based on v20250117.

pg_dump order seems not right.
CREATE FUNCTION public.test11(text) RETURNS text
    LANGUAGE sql
    AS $$select v4 $$;
CREATE VARIABLE public.v4 AS text;

first dump function then variable. restore would fail.
we should first dump variables then function.
probably placed it right after CREATE DOMAIN/CREATE TYPE


drop table if exists t3;
create variable v4 as text;
let v4 = 'hello';
CREATE TABLE t3 (a timestamp, v4 text);
INSERT INTO t3 SELECT i FROM generate_series('2020-01-01'::timestamp,
                                             '2020-12-31'::timestamp,
                                             '10 minute'::interval) s(i);
ANALYZE t3;
create or replace function test11(text) returns text as $$select v4 $$
language sql;
CREATE STATISTICS s4 (ndistinct) ON test11(v4), test11(v4 || 'h') FROM t3;
this "CREATE STATISTICS s4..." should error out?


any objects built on top of functions that use variables should be
marked as volatile.
and we should also consider the implications of it.





view thread (439+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Re: proposal: schema variables
  In-Reply-To: <CACJufxEwd5V82CpGykhKD3Pb9LfS_rgw3-dPrxdT0rwqnkvzQQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox