@@ -28,7 +28,7 @@ TS_FUNCTION_INFO_V1(bookend_deserializefunc);
28
28
/* A PolyDatum represents a polymorphic datum */
29
29
typedef struct PolyDatum
30
30
{
31
- Oid type ;
31
+ Oid type_oid ;
32
32
bool is_null ;
33
33
Datum datum ;
34
34
} PolyDatum ;
@@ -37,7 +37,7 @@ typedef struct PolyDatum
37
37
/* PolyDatumIOState is internal state used by polydatum_serialize and polydatum_deserialize */
38
38
typedef struct PolyDatumIOState
39
39
{
40
- Oid type ;
40
+ Oid type_oid ;
41
41
FmgrInfo proc ;
42
42
Oid typeioparam ;
43
43
} PolyDatumIOState ;
@@ -47,7 +47,7 @@ polydatum_from_arg(int argno, FunctionCallInfo fcinfo)
47
47
{
48
48
PolyDatum value ;
49
49
50
- value .type = get_fn_expr_argtype (fcinfo -> flinfo , argno );
50
+ value .type_oid = get_fn_expr_argtype (fcinfo -> flinfo , argno );
51
51
value .is_null = PG_ARGISNULL (argno );
52
52
if (!value .is_null )
53
53
{
@@ -66,7 +66,7 @@ polydatum_serialize(PolyDatum *pd, StringInfo buf, PolyDatumIOState *state, Func
66
66
{
67
67
bytea * outputbytes ;
68
68
69
- pq_sendint (buf , pd -> type , sizeof (Oid ));
69
+ pq_sendint (buf , pd -> type_oid , sizeof (Oid ));
70
70
71
71
if (pd -> is_null )
72
72
{
@@ -75,17 +75,17 @@ polydatum_serialize(PolyDatum *pd, StringInfo buf, PolyDatumIOState *state, Func
75
75
return ;
76
76
}
77
77
78
- if (state -> type != pd -> type )
78
+ if (state -> type_oid != pd -> type_oid )
79
79
{
80
80
Oid func ;
81
81
bool is_varlena ;
82
82
83
- getTypeBinaryOutputInfo (pd -> type ,
83
+ getTypeBinaryOutputInfo (pd -> type_oid ,
84
84
& func ,
85
85
& is_varlena );
86
86
fmgr_info_cxt (func , & state -> proc ,
87
87
fcinfo -> flinfo -> fn_mcxt );
88
- state -> type = pd -> type ;
88
+ state -> type_oid = pd -> type_oid ;
89
89
}
90
90
outputbytes = SendFunctionCall (& state -> proc , pd -> datum );
91
91
pq_sendint (buf , VARSIZE (outputbytes ) - VARHDRSZ , 4 );
@@ -110,7 +110,7 @@ polydatum_deserialize(PolyDatum *result, StringInfo buf, PolyDatumIOState *state
110
110
result = palloc (sizeof (PolyDatum ));
111
111
}
112
112
113
- result -> type = pq_getmsgint (buf , sizeof (Oid ));
113
+ result -> type_oid = pq_getmsgint (buf , sizeof (Oid ));
114
114
115
115
/* Following is copied/adapted from record_recv in core postgres */
116
116
@@ -151,16 +151,16 @@ polydatum_deserialize(PolyDatum *result, StringInfo buf, PolyDatumIOState *state
151
151
}
152
152
153
153
/* Now call the column's receiveproc */
154
- if (state -> type != result -> type )
154
+ if (state -> type_oid != result -> type_oid )
155
155
{
156
156
Oid func ;
157
157
158
- getTypeBinaryInputInfo (result -> type ,
158
+ getTypeBinaryInputInfo (result -> type_oid ,
159
159
& func ,
160
160
& state -> typeioparam );
161
161
fmgr_info_cxt (func , & state -> proc ,
162
162
fcinfo -> flinfo -> fn_mcxt );
163
- state -> type = result -> type ;
163
+ state -> type_oid = result -> type_oid ;
164
164
}
165
165
166
166
result -> datum = ReceiveFunctionCall (& state -> proc ,
@@ -197,24 +197,24 @@ typedef struct InternalCmpAggStoreIOState
197
197
198
198
typedef struct TypeInfoCache
199
199
{
200
- Oid type ;
200
+ Oid type_oid ;
201
201
int16 typelen ;
202
202
bool typebyval ;
203
203
} TypeInfoCache ;
204
204
205
205
inline static void
206
206
typeinfocache_init (TypeInfoCache * tic )
207
207
{
208
- tic -> type = InvalidOid ;
208
+ tic -> type_oid = InvalidOid ;
209
209
}
210
210
211
211
inline static void
212
212
typeinfocache_polydatumcopy (TypeInfoCache * tic , PolyDatum input , PolyDatum * output )
213
213
{
214
- if (tic -> type != input .type )
214
+ if (tic -> type_oid != input .type_oid )
215
215
{
216
- tic -> type = input .type ;
217
- get_typlenbyval (tic -> type , & tic -> typelen , & tic -> typebyval );
216
+ tic -> type_oid = input .type_oid ;
217
+ get_typlenbyval (tic -> type_oid , & tic -> typelen , & tic -> typebyval );
218
218
}
219
219
* output = input ;
220
220
if (!input .is_null )
@@ -239,22 +239,22 @@ cmpfunccache_init(CmpFuncCache *cache)
239
239
inline static bool
240
240
cmpfunccache_cmp (CmpFuncCache * cache , FunctionCallInfo fcinfo , char * opname , PolyDatum left , PolyDatum right )
241
241
{
242
- Assert (left .type == right .type );
242
+ Assert (left .type_oid == right .type_oid );
243
243
Assert (opname [1 ] == '\0' );
244
244
245
- if (cache -> cmp_type != left .type || cache -> op != opname [0 ])
245
+ if (cache -> cmp_type != left .type_oid || cache -> op != opname [0 ])
246
246
{
247
247
Oid cmp_op ,
248
248
cmp_regproc ;
249
249
250
- if (!OidIsValid (left .type ))
250
+ if (!OidIsValid (left .type_oid ))
251
251
elog (ERROR , "could not determine the type of the comparison_element" );
252
- cmp_op = OpernameGetOprid (list_make1 (makeString (opname )), left .type , left .type );
252
+ cmp_op = OpernameGetOprid (list_make1 (makeString (opname )), left .type_oid , left .type_oid );
253
253
if (!OidIsValid (cmp_op ))
254
- elog (ERROR , "could not find a %s operator for type %d" , opname , left .type );
254
+ elog (ERROR , "could not find a %s operator for type %d" , opname , left .type_oid );
255
255
cmp_regproc = get_opcode (cmp_op );
256
256
if (!OidIsValid (cmp_regproc ))
257
- elog (ERROR , "could not find the procedure for the %s operator for type %d" , opname , left .type );
257
+ elog (ERROR , "could not find the procedure for the %s operator for type %d" , opname , left .type_oid );
258
258
fmgr_info_cxt (cmp_regproc , & cache -> proc ,
259
259
fcinfo -> flinfo -> fn_mcxt );
260
260
}
0 commit comments