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 1tcoPI-002rQI-TS for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jan 2025 16:25:45 +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 1tcoPI-0026n4-0X for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jan 2025 16:25:44 +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 1tcoPH-0026k1-N8 for pgsql-hackers@lists.postgresql.org; Tue, 28 Jan 2025 16:25:43 +0000 Received: from mail-vs1-xe2b.google.com ([2607:f8b0:4864:20::e2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tcoPF-001yJ4-22 for pgsql-hackers@lists.postgresql.org; Tue, 28 Jan 2025 16:25:42 +0000 Received: by mail-vs1-xe2b.google.com with SMTP id ada2fe7eead31-4aff620b232so1766277137.0 for ; Tue, 28 Jan 2025 08:25:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738081541; x=1738686341; 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=a1+sgmWdFkA+CW3gOt0Np3t/KUCZkgGArtV2AYcndeY=; b=UsA7btemUrfXCxkuZwxfxTvYQR3mmCGQLZ1IA4JpOUZcT+yDiTDLc3lJPgWetUVmsa k8cEmKtKK9j6fcXc4HZ0hhLJS3ILjQzmR7c0EV7kXEoTRhXlcAuClL12/3QxMrV6T/2k xbnhgUEB8JRHLrXCz/3AVVRByf8UW2HoxzICzMtSCjRvoBSw326pw0GlFnFKC2BG5H8y tdEo0LxUItO9DJOw5k7sUxV6XcmTmks3KIqjZEdw0rdyxE5XaSX1wWAumV/3sKundLcR LSaHZeh40+wvJg1reToUqIAbnYwkOsm13Vkxr6dNS5whLbCan2KQEav5beH3AM6H0Rph +0Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738081541; x=1738686341; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a1+sgmWdFkA+CW3gOt0Np3t/KUCZkgGArtV2AYcndeY=; b=p+aLjsiJT8sKZlDHc7VWYakubN4Et9DKB7MzE58KZyK648VmV89Ft4iRTI7fRdBUwx vZcMlPwk54P5joI2u9MHietH4IVBsbhpUxUmHzNhDfeTj271qw++FyGbl0+CL6gYQwoe nkYVfWks34JbNmqwujvgR5qUY48aIkBH53+aYqfbAP5bFsDGW0QyHhrSov9HD8u3B76X li8cAkrERJBgsZr4qt01WwQ8XwLcDKYT2jVSjB1RsC73Qpcg3ubKw9O6WsgFv04yEEcJ uz+rXm5aVQPflGjSDKxbXrsITlPLt/fObdER7DDWcp0ljTQNT0BBlOaCx7ogWuaL2IPr RV1g== X-Forwarded-Encrypted: i=1; AJvYcCVPVODcfUEtwDryOb4JJYqBBHDMup/6Ya52lWwaDD0I7SA74nWRPhraGQDu3gVViRBowG4nvDW8MKjBafxx@lists.postgresql.org X-Gm-Message-State: AOJu0YxkGEikmc7ZYrU4DhRDdZxqSNDEJuoykO9UTQ3daUDIeY9DLH/s 2Cnvs5em8OX4etVXyxH/2m33wteT+EDY0fxn6YTv73Uhy3AtunLnRZgBK01KSBlSroU4SdVbQDS dz6OUMJy9Cnj9faUnEuoCnwg8+SncCi28jQMEUQ== X-Gm-Gg: ASbGncuJoudb0nxOHWp1z1c/4/5sSTqE7cFs9db0nlxDga/+zkjbNRmlSH+qxrsz8Pf mnFRYKZlyZVUA3I4AymWSo11LHYjer+0UwsPPqJDXUa7TfDrpJnLyIwtYUamH1rI71bx16Wl+Ya Xxg5LdHv9YG3d4ObgqKtXh0Q0yVPc= X-Google-Smtp-Source: AGHT+IHBF7JIykhqXzbOXJIBGJ9jhpP51W7xLJW30IwYbuIRHpbwd8RH39j2m3Ton1p5pTo4fRQ5kNYpzyXf3sP8+pE= X-Received: by 2002:a05:6122:2a4f:b0:518:8ac7:396b with SMTP id 71dfb90a1353d-51d5b3691b4mr34544583e0c.8.1738081541330; Tue, 28 Jan 2025 08:25:41 -0800 (PST) MIME-Version: 1.0 References: <4630636f-7720-4ce4-ab1c-253b390e5174@vondra.me> In-Reply-To: From: jian he Date: Wed, 29 Jan 2025 00:24:59 +0800 X-Gm-Features: AWEUYZkbBBcM0owMfZSdjO3_g-iSyaZF0iQJX5-Gy-0rsP57xHkFerW8rhtMyRY Message-ID: Subject: Re: Extended Statistics set/restore/clear functions. To: Corey Huinker Cc: Tomas Vondra , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk hi. I reviewed 0001 only. in src/backend/statistics/mvdistinct.c no need #include "nodes/pg_list.h" since src/include/statistics/statistics.h sub level include "nodes/pg_list.h" no need #include "utils/palloc.h" sicne #include "postgres.h" already included it. select '[{"6, -32768,,": -11}]'::pg_ndistinct; ERROR: malformed pg_ndistinct: "[{"6, -32768,,": -11}]" LINE 1: select '[{"6, -32768,,": -11}]'::pg_ndistinct; ^ DETAIL: All ndistinct count values are scalar doubles. imho, this errdetail message is not good. select '{}'::pg_ndistinct ; segfault select '{"1,":"1"}'::pg_ndistinct ; ERROR: malformed pg_ndistinct: "{"1,":"1"}" LINE 1: select '{"1,":"1"}'::pg_ndistinct ; ^ DETAIL: All ndistinct attnum lists must be a comma separated list of attnums. imho, this errdetail message is not good. would be better saying that "length of list of attnums must be larger than 1". select pt1.typnamespace, pt1.typarray, pt1.typcategory, pt1.typname from pg_type pt1 where pt1.typname ~*'distinct'; typnamespace | typarray | typcategory | typname --------------+----------+-------------+-------------- 11 | 0 | Z | pg_ndistinct typcategory (Z) marked as Internal-use types. and there is no pg_ndistinct array type, not sure this is fine. all the errcode one pair of the parenthesis is unnecessary. for example (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("malformed pg_ndistinct: \"%s\"", parse->str), errdetail("Must begin with \"{\""))); can change to errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("malformed pg_ndistinct: \"%s\"", parse->str), errdetail("Must begin with \"{\"")); see https://www.postgresql.org/docs/current/error-message-reporting.html