aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-03-04 10:34:25 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-03-04 10:34:25 -0500
commit3ed2005ff595d349276e5b2edeca1a8100b08c87 (patch)
tree361ca1ffdc3e816c98d45a0357c92d25ba71d760 /src/backend/utils/adt/jsonfuncs.c
parent0ad6f848eef267489d4aee7306c16f96454b7a64 (diff)
downloadpostgresql-3ed2005ff595d349276e5b2edeca1a8100b08c87.tar.gz
postgresql-3ed2005ff595d349276e5b2edeca1a8100b08c87.zip
Introduce macros for typalign and typstorage constants.
Our usual practice for "poor man's enum" catalog columns is to define macros for the possible values and use those, not literal constants, in C code. But for some reason lost in the mists of time, this was never done for typalign/attalign or typstorage/attstorage. It's never too late to make it better though, so let's do that. The reason I got interested in this right now is the need to duplicate some uses of the TYPSTORAGE constants in an upcoming ALTER TYPE patch. But in general, this sort of change aids greppability and readability, so it's a good idea even without any specific motivation. I may have missed a few places that could be converted, and it's even more likely that pending patches will re-introduce some hard-coded references. But that's not fatal --- there's no expectation that we'd actually change any of these values. We can clean up stragglers over time. Discussion: https://postgr.es/m/16457.1583189537@sss.pgh.pa.us
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
-rw-r--r--src/backend/utils/adt/jsonfuncs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index 6e33dfb2a2b..f92861d8d29 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -1019,7 +1019,7 @@ get_path_all(FunctionCallInfo fcinfo, bool as_text)
if (array_contains_nulls(path))
PG_RETURN_NULL();
- deconstruct_array(path, TEXTOID, -1, false, 'i',
+ deconstruct_array(path, TEXTOID, -1, false, TYPALIGN_INT,
&pathtext, &pathnulls, &npath);
tpath = palloc(npath * sizeof(char *));
@@ -1479,7 +1479,7 @@ get_jsonb_path_all(FunctionCallInfo fcinfo, bool as_text)
if (array_contains_nulls(path))
PG_RETURN_NULL();
- deconstruct_array(path, TEXTOID, -1, false, 'i',
+ deconstruct_array(path, TEXTOID, -1, false, TYPALIGN_INT,
&pathtext, &pathnulls, &npath);
/* Identify whether we have object, array, or scalar at top-level */
@@ -4361,7 +4361,7 @@ jsonb_delete_array(PG_FUNCTION_ARGS)
if (JB_ROOT_COUNT(in) == 0)
PG_RETURN_JSONB_P(in);
- deconstruct_array(keys, TEXTOID, -1, false, 'i',
+ deconstruct_array(keys, TEXTOID, -1, false, TYPALIGN_INT,
&keys_elems, &keys_nulls, &keys_len);
if (keys_len == 0)
@@ -4511,7 +4511,7 @@ jsonb_set(PG_FUNCTION_ARGS)
if (JB_ROOT_COUNT(in) == 0 && !create)
PG_RETURN_JSONB_P(in);
- deconstruct_array(path, TEXTOID, -1, false, 'i',
+ deconstruct_array(path, TEXTOID, -1, false, TYPALIGN_INT,
&path_elems, &path_nulls, &path_len);
if (path_len == 0)
@@ -4622,7 +4622,7 @@ jsonb_delete_path(PG_FUNCTION_ARGS)
if (JB_ROOT_COUNT(in) == 0)
PG_RETURN_JSONB_P(in);
- deconstruct_array(path, TEXTOID, -1, false, 'i',
+ deconstruct_array(path, TEXTOID, -1, false, TYPALIGN_INT,
&path_elems, &path_nulls, &path_len);
if (path_len == 0)
@@ -4665,7 +4665,7 @@ jsonb_insert(PG_FUNCTION_ARGS)
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("cannot set path in scalar")));
- deconstruct_array(path, TEXTOID, -1, false, 'i',
+ deconstruct_array(path, TEXTOID, -1, false, TYPALIGN_INT,
&path_elems, &path_nulls, &path_len);
if (path_len == 0)