aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.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/ruleutils.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/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 158784474d8..5e63238f030 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -2154,7 +2154,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
elog(ERROR, "null indkey for index %u", indexId);
deconstruct_array(DatumGetArrayTypeP(cols),
- INT2OID, 2, true, 's',
+ INT2OID, 2, true, TYPALIGN_SHORT,
&keys, NULL, &nKeys);
for (j = keyatts; j < nKeys; j++)
@@ -2279,7 +2279,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
constraintId);
deconstruct_array(DatumGetArrayTypeP(val),
- OIDOID, sizeof(Oid), true, 'i',
+ OIDOID, sizeof(Oid), true, TYPALIGN_INT,
&elems, NULL, &nElems);
operators = (Oid *) palloc(nElems * sizeof(Oid));
@@ -2335,7 +2335,7 @@ decompile_column_index_array(Datum column_index_array, Oid relId,
/* Extract data from array of int16 */
deconstruct_array(DatumGetArrayTypeP(column_index_array),
- INT2OID, 2, true, 's',
+ INT2OID, 2, true, TYPALIGN_SHORT,
&keys, NULL, &nKeys);
for (j = 0; j < nKeys; j++)
@@ -2730,7 +2730,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
-1 /* varlenarray */ ,
-1 /* TEXT's typlen */ ,
false /* TEXT's typbyval */ ,
- 'i' /* TEXT's typalign */ ,
+ TYPALIGN_INT /* TEXT's typalign */ ,
&isnull);
if (!isnull)
{
@@ -11277,7 +11277,7 @@ flatten_reloptions(Oid relid)
initStringInfo(&buf);
deconstruct_array(DatumGetArrayTypeP(reloptions),
- TEXTOID, -1, false, 'i',
+ TEXTOID, -1, false, TYPALIGN_INT,
&options, NULL, &noptions);
for (i = 0; i < noptions; i++)