v7-0002-miscellaneous-changes-for-new-options-engine-feat.patch

text/x-patch

Filename: v7-0002-miscellaneous-changes-for-new-options-engine-feat.patch
Type: text/x-patch
Part: 1
Message: Re: [PATCH] New [relation] option engine

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v7-0002
Subject: miscellaneous changes for new options engine feat.
File+
src/backend/access/common/options.c 10 10
src/include/access/options.h 3 3
From 76eb68eb1cc22578db57e8bf09190084dc586d3c Mon Sep 17 00:00:00 2001
From: jian he <jian.universality@gmail.com>
Date: Mon, 3 Jun 2024 10:37:48 +0800
Subject: [PATCH v7 2/2] miscellaneous changes for new options engine feat.

fix typo,
fix comments,
add trail comma for the last enum elemnt in the enum struct.
---
 src/backend/access/common/options.c | 20 ++++++++++----------
 src/include/access/options.h        |  6 +++---
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/common/options.c b/src/backend/access/common/options.c
index c626df35..e5399747 100644
--- a/src/backend/access/common/options.c
+++ b/src/backend/access/common/options.c
@@ -5,7 +5,7 @@
  *	  to process relation options (reloptions), attribute options, opclass
  *	  options, etc.
  *
- * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
@@ -42,7 +42,7 @@
  * optionsSpecSetAdd* functions that are used for adding Option Specs items to
  * a Set.
  *
- * NOTE: we choose therm "specification" instead of "definition" because therm
+ * NOTE: we choose term "specification" instead of "definition" because term
  * "definition" is used for objects that came from syntax parser. So to avoid
  * confusion here we have Option Specifications, and all "definitions" are from
  * parser.
@@ -85,7 +85,7 @@
  * Option data stored in C-structure with varlena header in the beginning of
  * the structure. This representation is used to pass option values to the core
  * postgres. It is fast to read, it can be cached and so on. Bytea
- * representation can be obtained from Vale List using optionsValuesToBytea
+ * representation can be obtained from Value List using optionsValuesToBytea
  * function, and can't be converted back.
  */
 
@@ -98,13 +98,13 @@
  * without any notion, so it can't have parts allocated separately.
  *
  * Thus memory chunk for Bytea option values representation is divided into two
- * parts. First goes a C-structure that stores fixed length vales. Then goes
+ * parts. First goes a C-structure that stores fixed length values. Then goes
  * memory area reserved for string values.
  *
  * For string values C-structure stores offsets (not pointers). These offsets
  * can be used to access attached string value:
  *
- * String_pointer = Bytea_head_pointer + offest.
+ * String_pointer = Bytea_head_pointer + offset.
  */
 
 static option_spec_basic *allocateOptionSpec(int type, const char *name,
@@ -133,7 +133,7 @@ static List *optionsMergeOptionValues(List *old_options, List *new_options);
  * namespace.option=value). Options from other namespaces will be ignored while
  * processing. If set to NULL, no namespace will be used at all.
  *
- * size_of_bytea - size of target structure of Bytea options representation
+ * bytea_size - size of target structure of Bytea options representation
  *
  * num_items_expected - if you know expected number of Spec Set items set it
  * here. Set to -1 in other cases. num_items_expected will be used for
@@ -215,7 +215,7 @@ allocateOptionSpec(int type, const char *name, const char *desc,
 			size = sizeof(option_spec_string);
 			break;
 		default:
-			elog(ERROR, "unsupported reloption type %d", type);
+			elog(ERROR, "unsupported reloption type %d", (int) type);
 			return NULL;		/* keep compiler quiet */
 	}
 
@@ -239,7 +239,7 @@ allocateOptionSpec(int type, const char *name, const char *desc,
 
 /*
  * optionSpecSetAddItem
- *		Adds pre-created Option Specification objec to the Spec Set
+ *		Adds pre-created Option Specification object to the Spec Set
  */
 static void
 optionSpecSetAddItem(option_spec_basic *newoption,
@@ -1036,7 +1036,7 @@ parse_one_option(option_value *option, bool validate)
 			}
 			break;
 		default:
-			elog(ERROR, "unsupported reloption type %d", option->gen->type);
+			elog(ERROR, "unsupported reloption type %d", (int) option->gen->type);
 			parsed = true;		/* quiet compiler */
 			break;
 	}
@@ -1241,7 +1241,7 @@ optionsValuesToBytea(List *options, options_spec_set *spec_set)
 				break;
 			default:
 				elog(ERROR, "unsupported reloption type %d",
-					 opt_spec->type);
+					 (int) opt_spec->type);
 				break;
 		}
 	}
diff --git a/src/include/access/options.h b/src/include/access/options.h
index dc5654d3..40a408c3 100644
--- a/src/include/access/options.h
+++ b/src/include/access/options.h
@@ -9,7 +9,7 @@
  * them as Datum, not ArrayType *, to avoid needing to include array.h
  * into a lot of low-level code.
  *
- * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
@@ -32,7 +32,7 @@ typedef enum option_type
 	OPTION_TYPE_INT,
 	OPTION_TYPE_REAL,
 	OPTION_TYPE_ENUM,
-	OPTION_TYPE_STRING
+	OPTION_TYPE_STRING,
 } option_type;
 
 typedef enum option_value_status
@@ -42,7 +42,7 @@ typedef enum option_value_status
 								 * has name, and raw (unparsed) value */
 	OPTION_VALUE_STATUS_PARSED, /* Option was parsed and has link to catalog
 								 * entry and proper value */
-	OPTION_VALUE_STATUS_FOR_RESET	/* This option came from ALTER xxx RESET */
+	OPTION_VALUE_STATUS_FOR_RESET,	/* This option came from ALTER xxx RESET */
 } option_value_status;
 
 /*
-- 
2.34.1