public inbox for [email protected]  
help / color / mirror / Atom feed
Re: Fast COPY FROM based on batch insert
3+ messages / 3 participants
[nested] [flat]

* Re: Fast COPY FROM based on batch insert
@ 2022-03-21 23:58 Andres Freund <[email protected]>
  2022-03-22 02:36 ` Re: Fast COPY FROM based on batch insert Etsuro Fujita <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Andres Freund @ 2022-03-21 23:58 UTC (permalink / raw)
  To: Andrey Lepikhov <[email protected]>; +Cc: [email protected] <[email protected]>; Etsuro Fujita <[email protected]>; Justin Pryzby <[email protected]>; Zhihong Yu <[email protected]>; Amit Langote <[email protected]>; [email protected] <[email protected]>; Ashutosh Bapat <[email protected]>; pgsql-hackers; Tomas Vondra <[email protected]>; [email protected] <[email protected]>

On 2021-06-07 16:16:58 +0500, Andrey Lepikhov wrote:
> Second version of the patch fixes problems detected by the FDW regression
> tests and shows differences of error reports in tuple-by-tuple and batched
> COPY approaches.

Patch doesn't apply and likely hasn't for a while...






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Fast COPY FROM based on batch insert
  2022-03-21 23:58 Re: Fast COPY FROM based on batch insert Andres Freund <[email protected]>
@ 2022-03-22 02:36 ` Etsuro Fujita <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Etsuro Fujita @ 2022-03-22 02:36 UTC (permalink / raw)
  To: Andres Freund <[email protected]>; +Cc: Andrey Lepikhov <[email protected]>; [email protected] <[email protected]>; Justin Pryzby <[email protected]>; Zhihong Yu <[email protected]>; Amit Langote <[email protected]>; [email protected] <[email protected]>; Ashutosh Bapat <[email protected]>; pgsql-hackers; Tomas Vondra <[email protected]>; [email protected] <[email protected]>

On Tue, Mar 22, 2022 at 8:58 AM Andres Freund <[email protected]> wrote:
>
> On 2021-06-07 16:16:58 +0500, Andrey Lepikhov wrote:
> > Second version of the patch fixes problems detected by the FDW regression
> > tests and shows differences of error reports in tuple-by-tuple and batched
> > COPY approaches.
>
> Patch doesn't apply and likely hasn't for a while...

Actually, it has bit-rotted due to the recent fix for cross-partition
updates (i.e., commit ba9a7e392).

Thanks!

Best regards,
Etsuro Fujita






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [PATCH v3 1/1] Handle a NULL short_desc in ShowAllGUCConfig
@ 2022-05-25 04:46 Steve Chavez <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Steve Chavez @ 2022-05-25 04:46 UTC (permalink / raw)

Prevent a segfault when using a SHOW ALL, in case a DefineCustomXXXVariable()
was defined with a NULL short_desc.
---
 src/backend/utils/misc/guc.c | 16 +++++++++++++---
 src/include/c.h              | 10 ++++++++++
 src/include/utils/guc.h      | 10 +++++-----
 3 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 8e9b71375c..55d41ae7d6 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -9780,7 +9780,16 @@ ShowAllGUCConfig(DestReceiver *dest)
 			isnull[1] = true;
 		}
 
-		values[2] = PointerGetDatum(cstring_to_text(conf->short_desc));
+		if (conf->short_desc)
+		{
+			values[2] = PointerGetDatum(cstring_to_text(conf->short_desc));
+			isnull[2] = false;
+		}
+		else
+		{
+			values[2] = PointerGetDatum(NULL);
+			isnull[2] = true;
+		}
 
 		/* send it to dest */
 		do_tup_output(tstate, values, isnull);
@@ -9792,7 +9801,8 @@ ShowAllGUCConfig(DestReceiver *dest)
 			pfree(setting);
 			pfree(DatumGetPointer(values[1]));
 		}
-		pfree(DatumGetPointer(values[2]));
+		if (conf->short_desc)
+			pfree(DatumGetPointer(values[2]));
 	}
 
 	end_tup_output(tstate);
@@ -10002,7 +10012,7 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
 	values[3] = _(config_group_names[conf->group]);
 
 	/* short_desc */
-	values[4] = _(conf->short_desc);
+	values[4] = conf->short_desc != NULL ? _(conf->short_desc) : NULL;
 
 	/* extra_desc */
 	values[5] = conf->long_desc != NULL ? _(conf->long_desc) : NULL;
diff --git a/src/include/c.h b/src/include/c.h
index 4f16e589b3..f253aa930b 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -144,6 +144,16 @@
 #define pg_attribute_no_sanitize_alignment()
 #endif
 
+/*
+ * pg_attribute_nonnull means the compiler should warn if the function is called
+ * with the listed arguments set to NULL.
+ */
+#if defined(__clang_major__) || defined(__GNUC__)
+#define pg_attribute_nonnull(...) __attribute__((nonnull(__VA_ARGS__)))
+#else
+#define pg_attribute_nonnull(...)
+#endif
+
 /*
  * Append PG_USED_FOR_ASSERTS_ONLY to definitions of variables that are only
  * used in assert-enabled builds, to avoid compiler warnings about unused
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index efcbad7842..be691c5e9c 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -303,7 +303,7 @@ extern void DefineCustomBoolVariable(const char *name,
 									 int flags,
 									 GucBoolCheckHook check_hook,
 									 GucBoolAssignHook assign_hook,
-									 GucShowHook show_hook);
+									 GucShowHook show_hook) pg_attribute_nonnull(1, 4);
 
 extern void DefineCustomIntVariable(const char *name,
 									const char *short_desc,
@@ -316,7 +316,7 @@ extern void DefineCustomIntVariable(const char *name,
 									int flags,
 									GucIntCheckHook check_hook,
 									GucIntAssignHook assign_hook,
-									GucShowHook show_hook);
+									GucShowHook show_hook) pg_attribute_nonnull(1, 4);
 
 extern void DefineCustomRealVariable(const char *name,
 									 const char *short_desc,
@@ -329,7 +329,7 @@ extern void DefineCustomRealVariable(const char *name,
 									 int flags,
 									 GucRealCheckHook check_hook,
 									 GucRealAssignHook assign_hook,
-									 GucShowHook show_hook);
+									 GucShowHook show_hook) pg_attribute_nonnull(1, 4);
 
 extern void DefineCustomStringVariable(const char *name,
 									   const char *short_desc,
@@ -340,7 +340,7 @@ extern void DefineCustomStringVariable(const char *name,
 									   int flags,
 									   GucStringCheckHook check_hook,
 									   GucStringAssignHook assign_hook,
-									   GucShowHook show_hook);
+									   GucShowHook show_hook) pg_attribute_nonnull(1, 4);
 
 extern void DefineCustomEnumVariable(const char *name,
 									 const char *short_desc,
@@ -352,7 +352,7 @@ extern void DefineCustomEnumVariable(const char *name,
 									 int flags,
 									 GucEnumCheckHook check_hook,
 									 GucEnumAssignHook assign_hook,
-									 GucShowHook show_hook);
+									 GucShowHook show_hook) pg_attribute_nonnull(1, 4);
 
 extern void MarkGUCPrefixReserved(const char *className);
 
-- 
2.25.1


--Dxnq1zWXvFF0Q93v--





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-05-25 04:46 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 23:58 Re: Fast COPY FROM based on batch insert Andres Freund <[email protected]>
2022-03-22 02:36 ` Etsuro Fujita <[email protected]>
2022-05-25 04:46 [PATCH v3 1/1] Handle a NULL short_desc in ShowAllGUCConfig Steve Chavez <[email protected]>

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