Skip to content

Commit 3950944

Browse files
committed
Fix for some warnings and compilation problems
1 parent dfea49f commit 3950944

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

src/backend/commands/typecmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ DefineType(List *names, List *parameters)
165165
Oid resulttype;
166166
ListCell *pl;
167167
ObjectAddress address;
168-
Oid subscriptionOid;
168+
Oid subscriptionOid = InvalidOid;
169169

170170
/*
171171
* As of Postgres 8.4, we require superuser privilege to create a base

src/backend/executor/execQual.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ ExecEvalSubscriptionRef(SubscriptionRefExprState *sbstate,
273273
RegProcedure typsubscription;
274274
bool isAssignment = (sbsRef->refassgnexpr != NULL);
275275
bool eisnull;
276-
Datum *upper,
277-
*lower;
276+
Datum *upper = NULL,
277+
*lower = NULL;
278278
ListCell *l;
279279
int i = 0,
280280
j = 0;

src/backend/utils/adt/arrayfuncs.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "catalog/pg_type.h"
2525
#include "funcapi.h"
2626
#include "libpq/pqformat.h"
27+
#include "nodes/makefuncs.h"
2728
#include "nodes/nodeFuncs.h"
2829
#include "utils/array.h"
2930
#include "utils/arrayaccess.h"
@@ -161,7 +162,8 @@ static int width_bucket_array_variable(Datum operand,
161162
ArrayType *thresholds,
162163
Oid collation,
163164
TypeCacheEntry *typentry);
164-
165+
static Datum array_subscription_prepare(PG_FUNCTION_ARGS);
166+
static Datum array_subscription_evaluate(PG_FUNCTION_ARGS);
165167

166168
/*
167169
* array_in :
@@ -6727,9 +6729,10 @@ array_subscription_prepare(PG_FUNCTION_ARGS)
67276729
ParseState *pstate = (ParseState *) PG_GETARG_POINTER(1);
67286730
Node *node = (Node *)sbsref;
67296731
Oid array_type = sbsref->refcontainertype;
6730-
Oid array_typ_mode = sbsref->reftypmod;
6732+
int32 array_typ_mode = (int32) sbsref->reftypmod;
67316733
bool is_slice = sbsref->reflowerindexpr != NIL;
6732-
Oid typeneeded, typesource;
6734+
Oid typeneeded = InvalidOid,
6735+
typesource = InvalidOid;
67336736
Node *new_from;
67346737
Oid element_type_id;
67356738
Node *subexpr;
@@ -6849,12 +6852,12 @@ array_subscription_prepare(PG_FUNCTION_ARGS)
68496852
format_type_be(sbsref->refcontainertype)),
68506853
parser_errposition(pstate, 0)));
68516854

6852-
return node;
6855+
PG_RETURN_POINTER(node);
68536856
}
68546857

68556858
}
68566859

6857-
return sbsref;
6860+
PG_RETURN_POINTER(sbsref);
68586861
}
68596862

68606863
Datum
@@ -6865,12 +6868,10 @@ array_subscription(PG_FUNCTION_ARGS)
68656868
fcinfo->nargs);
68666869

68676870
if (op_type & SBS_VALIDATION)
6868-
{
68696871
return array_subscription_prepare(&target_fcinfo);
6870-
}
68716872

68726873
if (op_type & SBS_EXEC)
6873-
{
68746874
return array_subscription_evaluate(&target_fcinfo);
6875-
}
6875+
6876+
elog(ERROR, "incorrect op_type for subscription function: %d", op_type);
68766877
}

src/backend/utils/adt/jsonfuncs.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3924,9 +3924,9 @@ setPathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
39243924
static void
39253925
setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
39263926
int path_len, JsonbParseState **st, int level,
3927-
Jsonb *newval, uint32 nelems, int op_type)
3927+
JsonbValue *newval, uint32 nelems, int op_type)
39283928
{
3929-
JsonbValue v;
3929+
JsonbValue v, *new = (JsonbValue *) newval;
39303930
int idx,
39313931
i;
39323932
bool done = false;
@@ -3971,8 +3971,8 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
39713971
if ((idx == INT_MIN || nelems == 0) && (level == path_len - 1) &&
39723972
(op_type & JB_PATH_CREATE_OR_INSERT))
39733973
{
3974-
Assert(newval != NULL);
3975-
(void) pushJsonbValue(st, WJB_ELEM, newval);
3974+
Assert(new != NULL);
3975+
(void) pushJsonbValue(st, WJB_ELEM, new);
39763976
done = true;
39773977
}
39783978

@@ -3988,7 +3988,7 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
39883988
r = JsonbIteratorNext(it, &v, true); /* skip */
39893989

39903990
if (op_type & (JB_PATH_INSERT_BEFORE | JB_PATH_CREATE))
3991-
(void) pushJsonbValue(st, WJB_ELEM, newval);
3991+
(void) pushJsonbValue(st, WJB_ELEM, new);
39923992

39933993
/*
39943994
* We should keep current value only in case of
@@ -3999,13 +3999,13 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
39993999
(void) pushJsonbValue(st, r, &v);
40004000

40014001
if (op_type & JB_PATH_INSERT_AFTER)
4002-
(void) pushJsonbValue(st, WJB_ELEM, newval);
4002+
(void) pushJsonbValue(st, WJB_ELEM, new);
40034003

40044004
done = true;
40054005
}
40064006
else
40074007
(void) setPath(it, path_elems, path_nulls, path_len,
4008-
st, level + 1, newval, op_type);
4008+
st, level + 1, new, op_type);
40094009
}
40104010
else
40114011
{

0 commit comments

Comments
 (0)