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 1wbzXo-0030Fu-2i for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Jun 2026 11:43:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wbzXn-00BSpR-24 for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Jun 2026 11:43:55 +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.96) (envelope-from ) id 1wbzXn-00BSpI-18 for pgsql-hackers@lists.postgresql.org; Tue, 23 Jun 2026 11:43:55 +0000 Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wbzXm-00000001joL-0Z32 for pgsql-hackers@postgresql.org; Tue, 23 Jun 2026 11:43:54 +0000 Received: by mail-vs1-xe2f.google.com with SMTP id ada2fe7eead31-6c3154fa47fso4544389137.2 for ; Tue, 23 Jun 2026 04:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782215032; cv=none; d=google.com; s=arc-20240605; b=cGtRE2TD6d2nk1gQtNwxKXx2B4UPza2WdqoGEizDyDBT5ax6MCNx3GnfQ3W2hBmpIC d4ARwxR3FW5qCCP+AxbQ1iqSUn4HRAgHyfIcbpL+7EPRmmMF92jBPHFFhHuALEFXHhYx ZsYdVrSQBbIY4WT4ny+Daef4aqreqqqKNaUJa1nta0xBPpiOtVWorXKy3BzM4bRGVSfW S/DsPNlyTpyRTG21CZKWanBm628I2A5BJvpJ3pPEkV/MIfsWfER1Rht9BMwluPWIjpeE 3bh/GOz/d+DI9yeNhqzq5zeubSwF1UCfrLH61ec/R7o+j4qOkdISmX+Hi3ITsM/9/8xg VPAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=rRgGl2idgSh54XcxibrZJS0ELeJXV0+qqxMFEFy2Rp8=; fh=MDrGf220fSqBDPQ7ybvGGTes7ZNQHaKIAKWSHwl/Apg=; b=TIt0j7utI9EuIDN7qvdLsBYDtpC5BaJ9QhaBWasOeEId7uhR82Bg4ZqcBJmzcDJ0S0 tmqZ6hxiUUW6/ryKcF9K9aSSAFtzdAOiX9kou9dNt+sT+b0vS3d6yVcljGJR992oWZke 0nJcaRtG9nMRPovYEB6Wa7JmrIxlTW519hoxOQNhLd8ZDG8PuMMofoUmAeL1xaljk+Tb r1TnfCH7/aOcXZqQyeLvN2vrxj0XGsZvxJxPSVkwpK11Mo6tmdoMLn8yMSZ9oJw3tZq4 xCbiLV2jw2iazp+Ma7HpmOVhiVnZJ9Rb09brlW+EQeieEfLXDSvQJiJMihrnRTsmBu6L 3NbA==; darn=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=20251104; t=1782215032; x=1782819832; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=rRgGl2idgSh54XcxibrZJS0ELeJXV0+qqxMFEFy2Rp8=; b=iqU49Ez1k/6+IqhxeR/KAVjuHgnEdL/dzFl1y5ZenRjSD89bkP1kKsxSHu+WucETPR WvOd2ECZmW0M8zYIL1RyKCRjo0UQLZb/qaM9nZbTJGiSiXaNgCjmNwdgitQczbrKbkXm ZRonxlNzbDOudChHqP5IcBvkEIHmZcBVvhddP48K/Wjd3875F5LPTnsKz77c/qs7pSZV cM77dbQ+ra4tdRqCqFq5+b47dBDVApOIcqI7B9gMsBcD3klLvI6xgZ8Vhi1S4vBWFNCk XWsilv0mYS2RVEVd+jbysateuK/RnjjXRdJMoDn5K+6Sl8ahQ91FK3O+qOSVfZp0aGzs WBww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782215032; x=1782819832; h=content-transfer-encoding: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=rRgGl2idgSh54XcxibrZJS0ELeJXV0+qqxMFEFy2Rp8=; b=AFFkNu8ZOsx36jmMGKJ876PFGM3A8bw0ml+P7jMCh7Yn7Lm1q8qx1DOtEY2ZZaSWq/ xjIWkuvfxe8lyIQ35KDd3R7nKQPylyaMW7H/IQmT8rBGobOqcD2TMkKUilrN43GTfcKN ub5Jy+39TDIdehYt8SDwa0Yisl4G8x8qDu++xMIbE0RsIksLBLx7iKjB0lBBhVXc9Fdq lR4PkNrYXYfC4UUDPT2aP0O5oIj5zBfsJRS7iTj6yup2yQmG/QL5+T6TkQda48SAMXdu Bl+Sszev8IsTFg9zrgtvQpoS8SkEkwFQufbJCzhIs/1RCrNXAf8lc+71wk+ncNAgNczJ RlNA== X-Forwarded-Encrypted: i=1; AFNElJ9hy5aJWEeBY5a0VctbTIZvY6a5oV66X6N9luKjqRJe8uMEblZxS9d/KY4wrJlf51y6C7sNmXoNZ4BK7BQF@postgresql.org X-Gm-Message-State: AOJu0YyztoDmom+C6LFVoNZ8gsuo4V3Doj+aWyU/CHJDBHjEKoJdCpLX vL/7d3X46nVTeFiEVbdJAVFUWVvV5GegkAct9XDN7P05bp/aNY7OCSg5T7kPLNC33pNBoKp36IE Xlo6/ABvDlTVR2lFgCjRqYpFCllechcg= X-Gm-Gg: AfdE7cmshq4waSRxUZrGrOfaGpGQeoGHwnQeZ7jRYl6MEb+R8FsahLOlOi2/UBUQ6UC CQQqCEH9AS8yKvwhvZu7vLCDucVkfPw46VRGfcLeYhi1s78KjoTh96FYzWmGwNRQIbMpytyKswM 2PfrPfbygu91geNYkc8agC4+y97u7WdJj5wuyldGPCO7PwjfHKsYMsvN5sCDaKMr5IOfFdfBtH4 hjWJEiQLfaY+VSW1K5p6cM/mk8u+FKGvEvA16Ymu9voIfGfHKJ+U6s8xvmprSc7npQj7ziFLyl5 D1HlwmDVM8R6g6tX+uAqjqNawvVMni8kSUe2BDmoCyGRSwlrBa8YXnQuukmUOfvT9NXODHeM0cp pHPLCfKP9CLWRsKNDYON6tpECfebT/FaOa8bnYDKNXaHq3x5D2omFE9lR3B4kG9QDLCPyaIHF2v 2ZCTwBD3gXktVLyUR7YbpVEHCDHw== X-Received: by 2002:a05:6102:5120:b0:633:1fbe:79c8 with SMTP id ada2fe7eead31-72a1faf50e0mr10609103137.23.1782215031476; Tue, 23 Jun 2026 04:43:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: jian he Date: Tue, 23 Jun 2026 19:43:14 +0800 X-Gm-Features: AVVi8CdTWVf5JZQuVrCr-Y4nwp3b-MN2qewqYpSHgOzDYbWiOGHnFl7D494pDyI Message-ID: Subject: Re: use of SPI by postgresImportForeignStatistics To: Corey Huinker Cc: Robert Haas , Etsuro Fujita , "pgsql-hackers@postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jun 23, 2026 at 3:08=E2=80=AFAM Corey Huinker wrote: > > To that end, here's a new and rebased patch set: > > 0001 - exactly the same as before +/* + * Convenience routine to parse float values, and emit a warning on parse + * errors. + * + * Returns -1.0 if the value is NULL or invalid. + */ +static float +str_to_float(const char *s) +{ + const float default_value =3D -1.0; + + float result; + + ErrorSaveContext escontext =3D {T_ErrorSaveContext}; + + if (!s) + return default_value; + + result =3D float4in_internal((char *) s, NULL, "float", s, (Node *) &esco= ntext); + + if (escontext.error_occurred) + { + escontext.error_data->elevel =3D WARNING; + ThrowErrorData(escontext.error_data); + FreeErrorData(escontext.error_data); + return default_value; + } + + return result; +} + Just a quick thought: the above can be replaced by InputFunctionCallSafe? -- jian https://www.enterprisedb.com/