| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
| Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: use of SPI by postgresImportForeignStatistics |
| Date: | 2026-06-23 11:43:14 |
| Message-ID: | CACJufxEoNOAOqomVzo7KukvxqLoknvh47-3=bmcj_hEvgyC8iA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Jun 23, 2026 at 3:08 AM Corey Huinker <corey(dot)huinker(at)gmail(dot)com> 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 = -1.0;
+
+ float result;
+
+ ErrorSaveContext escontext = {T_ErrorSaveContext};
+
+ if (!s)
+ return default_value;
+
+ result = float4in_internal((char *) s, NULL, "float", s, (Node *) &escontext);
+
+ if (escontext.error_occurred)
+ {
+ escontext.error_data->elevel = 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?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ajin Cherian | 2026-06-23 11:50:18 | Re: [PATCH] Preserve replication origin OIDs in pg_upgrade |
| Previous Message | solai v | 2026-06-23 11:39:10 | Re: Support EXCEPT for ALL SEQUENCES publications |