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 1w2EB6-0006Ty-2P for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 20:04: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 1w2EB4-00CemG-2n for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 20:04:39 +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 1w2EB4-00Cem8-1l for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 20:04:39 +0000 Received: from mail-dl1-x122c.google.com ([2607:f8b0:4864:20::122c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2EB2-00000000TxI-3tDP for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 20:04:39 +0000 Received: by mail-dl1-x122c.google.com with SMTP id a92af1059eb24-1279eced0b9so6707524c88.0 for ; Mon, 16 Mar 2026 13:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773691475; cv=none; d=google.com; s=arc-20240605; b=jmjtPIivSARnRrCg4E7D0VMPMDe9n8dcZJt/h5vl7dzW4x3FIBKzuKPx47wDGEOnnS M6TQcaD0cqjywZV450iKhRW4EETGQm53AqKcxq+bbAvJkPvxkwNGrzVW+S/QpV1eZNL+ 1qJ/OiBBlon1pB1dVi3sLXZU2AV1NJRzx0Jalpw3TAWeOLckU134t/i98RcL7T5ZFKtz X0MD7ydKXtAjG47nOxVCtZ1TbcHYXWITz716RPLNj2lLHJFKgSmHVHeDCuV8M6IttfBi S1YPt4TqTgSS/ODAq0KCvfd5qANIn+2oA7bHLaVC3WS6eq5II7UUDE5I2U7+4NNwBA52 X5KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=C5RltbAFrenVaUbCB58Xjj8piHKkBv+GJxkISAuWBjM=; fh=+hKvCnZy2RLwTHtjhexRcC6CyonKQb2y6CNNw97GcrE=; b=UEJjk+3rT+0cWbHzvyZmJrUBlwXlg7eLF9H758BskZLPpSiZU7cpmZJ1kvZXquuzQv zZuWi9rhXRAMVUleiMi3sqEoRHX+6+RvQgvbTgIsPqUvbY5iinZiC7/nMYG1JY2QTRvL hS/b25fv/pXHJ8XOXyER1Qx3xTVXbyk1es5COBQjXcv0tS3PWf+7M8iNQvZ/WLEaC81p 15n6Zsv+YIFeyDBY96Choy/ADmmd6guP9PItcmRmoTacNWNg5HXn/VqrcU1LT7RZQbn+ y5E5DpTY5pAYNqNlJVOe/BaCI5gEDCJPEKnctMcTJt+m52pLPBybF7eWe0YahwcEctHY SjRw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773691475; x=1774296275; 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=C5RltbAFrenVaUbCB58Xjj8piHKkBv+GJxkISAuWBjM=; b=HHBfsAqYlyDcDYyjOsDJqcPYdZEEg3FZyQGuQzbqlWd+YDO80F17v9RiMhK5cL8P1B b7iLDrV1ikI5thuRpcAgcVOxTf104FgzNuRYFnJAMzv2Zy+cD6HgJgSPcdU2vBt3rqtA /Fs67yaftlJGdNB6y0EbAZCeQmH1y7jEAGJzELHjLnnKJ5Fps4HRQJlEFiQvVLwNfvM2 05Ng8QdwMRh2AuKOqZT/7/5Upr4Xp2AbjX5tDt2KJkSvG7vi1F8IxXo1vIQxTbu1mP7j TeceNgg6/r2yt4P4veyPUM/btGZH/1yZXiEPrso2FRhl39LEhMTtVm3VOn8QhyANVs7m lQiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773691475; x=1774296275; 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=C5RltbAFrenVaUbCB58Xjj8piHKkBv+GJxkISAuWBjM=; b=LScDu9dpe3znBCXNnWHaMl6rfC+F95e1tvO9XQ8bHcwNETO4Z4BxNHaYBbay9gyYMU FXwhS0LSTo6STOeDrh0sNdvd1QvPglCX9AHNuBEIyhxQj49OPKaDIo6ASHtXp5toX0Su /vTEkSr+fcl6JZXKh92tXrWMi96PEj6cKR/StnjMCI+SPTIkaayrGPopLe+yqQvNWpYX hhIaK85MXixN80fLqtY6nlSgJUOpNK3DVGVd7P4LXDtVe6Px+EthxFiIP84Br2h8AhC9 iumCk+eops19MfhtweXMmTm2SDziWgzYpjviNuEzrWRoxhuPr6LAy7lENj/g/Z3gf0v7 gDfA== X-Forwarded-Encrypted: i=1; AJvYcCUr92rosFnzUUcShG+IBx5i9H0kTmCE3XPHYeeCQDilRIj8xrMftQsI3OhlwPJQR+VrBbPYRLE2ZtBoP/ZQ@lists.postgresql.org X-Gm-Message-State: AOJu0YzLowC3yBCDSDzyDw5K0eO7i/48vuMkQKtlJuCx1pwOzYGHZSjH +LZocJT98VsjIIK9CUTcAARYtpO5UJzV6lMBqF0iuqOav2xMsAuMRQmdp9bWz4pyh9UIe7wjpUf qtXnZDDKwwS32uM0AgzJGoqn8BmiTvLs= X-Gm-Gg: ATEYQzwkQy+3q8vmDHb/h7J7fMv5WFX3BR+FJCP0ps64cApN16MCvZE5BcTkH1Fly5T u5Ko4AyNSp8HLT2dfuVBfsMh0m2OAPU3Itb7hJXV+X7mPNiwWPk/B7LcvNMlFCP9eVIeEhJLrdN fvT2LSA8HEkm5M7ZH1JLsO81jYc7p6cUuQ3+qULk4IOqWhrv5cNmvrf4Gj9f8z2sR8diMsVo4Kp MzXICLnNlag0yJVl61uct7fTOA0yp0iZ52gJr6lNVqRcREI0xxGE4fSUrc2lLwsSs3zEDzSDDs9 E69arhC5ZiISAZ+y/+3WD5oijZJrVDmayUCHTt9u/moKzFuKVEVNZps/a6OiMz7VB1hKMXA6W1/ Od5kUFDzq8+KgzoViHbaR/uDP0CkkFkqfvIQ= X-Received: by 2002:a05:7022:4397:b0:128:bec5:1b37 with SMTP id a92af1059eb24-128f3dbe3bemr6836001c88.16.1773691475154; Mon, 16 Mar 2026 13:04:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Corey Huinker Date: Mon, 16 Mar 2026 16:04:23 -0400 X-Gm-Features: AaiRm50OSmsJdUEFl-_bOR8SSHV8dxkvbKmOhe6BxSRXh2e6SP7k8ZEkmpcN_dY Message-ID: Subject: Re: Add starelid, attnum to pg_stats and leverage this in pg_dump To: Nathan Bossart Cc: Sami Imseih , pgsql-hackers@lists.postgresql.org, michael@paquier.xyz Content-Type: multipart/alternative; boundary="000000000000515c37064d29bafb" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000515c37064d29bafb Content-Type: text/plain; charset="UTF-8" > > > > CREATE VIEW pg_stats_ext_exprs WITH (security_barrier) AS > > SELECT cn.nspname AS schemaname, > > c.relname AS tablename, > > + s.stxrelid AS tableid, > > sn.nspname AS statistics_schemaname, > > s.stxname AS statistics_name, > > + s.oid AS statid, > > pg_get_userbyid(s.stxowner) AS statistics_owner, > > - stat.expr, > > + expr.expr, > > + 0 - expr.ordinality AS expr_attnum, > > I left the expr_attnum stuff out. It seems to make this patch quite large > and complicated, we don't plan to use it for the pg_dump patch, and I'm not > sure about showing users a "synthetic attnum" that seems to have no other > point of reference. Would this information be useful in pg_dump somewhere? > I'm curious to hear more about the intent. > expr_attnum was something that Michael Paquier had lamented that the view didn't have. There is obviously no present need for it, as pg_dump isn't being modified for extended stats at all. > I didn't see much value in adding attnum here given the size of the changes > to the expected output it produces. > Same reasons for putting that in - people had lamented that we couldn't order the dump by attnum, and ordering by attname feels weird somehow. Again, we don't presently need it. --000000000000515c37064d29bafb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

>=C2=A0 CREATE VIEW pg_stats_ext_exprs WITH (security_barrier) AS
>=C2=A0 =C2=A0 =C2=A0 SELECT cn.nspname AS schemaname,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0c.relname AS tablename,=
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s.stxrelid AS tableid,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sn.nspname AS statistic= s_schemaname,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s.stxname AS statistics= _name,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s.oid AS statid,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pg_get_userbyid(s.stxow= ner) AS statistics_owner,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0stat.expr,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0expr.expr,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00 - expr.ordinality AS expr_= attnum,

I left the expr_attnum stuff out.=C2=A0 It seems to make this patch quite l= arge
and complicated, we don't plan to use it for the pg_dump patch, and I&#= 39;m not
sure about showing users a "synthetic attnum" that seems to have = no other
point of reference.=C2=A0 Would this information be useful in pg_dump somew= here?
I'm curious to hear more about the intent.

expr_attnum was something that Michael Paquier had lamented that th= e view didn't have. There is obviously no present need for it, as pg_du= mp isn't being modified for extended stats at all.
=C2=A0
I didn't= see much value in adding attnum here given the size of the changes
to the expected output it produces.

Sam= e reasons for putting that in - people had lamented that we couldn't or= der the dump by attnum, and ordering by attname feels weird somehow. Again,= we don't presently need it.
--000000000000515c37064d29bafb--