49
49
typedef struct RangeIOData
50
50
{
51
51
TypeCacheEntry * typcache ; /* range type's typcache entry */
52
- Oid typiofunc ; /* element type's I/O function */
52
+ FmgrInfo typioproc ; /* element type's I/O function */
53
53
Oid typioparam ; /* element type's I/O parameter */
54
- FmgrInfo proc ; /* lookup result for typiofunc */
55
54
} RangeIOData ;
56
55
57
56
@@ -100,10 +99,10 @@ range_in(PG_FUNCTION_ARGS)
100
99
101
100
/* call element type's input function */
102
101
if (RANGE_HAS_LBOUND (flags ))
103
- lower .val = InputFunctionCall (& cache -> proc , lbound_str ,
102
+ lower .val = InputFunctionCall (& cache -> typioproc , lbound_str ,
104
103
cache -> typioparam , typmod );
105
104
if (RANGE_HAS_UBOUND (flags ))
106
- upper .val = InputFunctionCall (& cache -> proc , ubound_str ,
105
+ upper .val = InputFunctionCall (& cache -> typioproc , ubound_str ,
107
106
cache -> typioparam , typmod );
108
107
109
108
lower .infinite = (flags & RANGE_LB_INF ) != 0 ;
@@ -142,9 +141,9 @@ range_out(PG_FUNCTION_ARGS)
142
141
143
142
/* call element type's output function */
144
143
if (RANGE_HAS_LBOUND (flags ))
145
- lbound_str = OutputFunctionCall (& cache -> proc , lower .val );
144
+ lbound_str = OutputFunctionCall (& cache -> typioproc , lower .val );
146
145
if (RANGE_HAS_UBOUND (flags ))
147
- ubound_str = OutputFunctionCall (& cache -> proc , upper .val );
146
+ ubound_str = OutputFunctionCall (& cache -> typioproc , upper .val );
148
147
149
148
/* construct result string */
150
149
output_str = range_deparse (flags , lbound_str , ubound_str );
@@ -199,7 +198,7 @@ range_recv(PG_FUNCTION_ARGS)
199
198
initStringInfo (& bound_buf );
200
199
appendBinaryStringInfo (& bound_buf , bound_data , bound_len );
201
200
202
- lower .val = ReceiveFunctionCall (& cache -> proc ,
201
+ lower .val = ReceiveFunctionCall (& cache -> typioproc ,
203
202
& bound_buf ,
204
203
cache -> typioparam ,
205
204
typmod );
@@ -217,7 +216,7 @@ range_recv(PG_FUNCTION_ARGS)
217
216
initStringInfo (& bound_buf );
218
217
appendBinaryStringInfo (& bound_buf , bound_data , bound_len );
219
218
220
- upper .val = ReceiveFunctionCall (& cache -> proc ,
219
+ upper .val = ReceiveFunctionCall (& cache -> typioproc ,
221
220
& bound_buf ,
222
221
cache -> typioparam ,
223
222
typmod );
@@ -268,7 +267,7 @@ range_send(PG_FUNCTION_ARGS)
268
267
269
268
if (RANGE_HAS_LBOUND (flags ))
270
269
{
271
- Datum bound = PointerGetDatum (SendFunctionCall (& cache -> proc ,
270
+ Datum bound = PointerGetDatum (SendFunctionCall (& cache -> typioproc ,
272
271
lower .val ));
273
272
uint32 bound_len = VARSIZE (bound ) - VARHDRSZ ;
274
273
char * bound_data = VARDATA (bound );
@@ -279,7 +278,7 @@ range_send(PG_FUNCTION_ARGS)
279
278
280
279
if (RANGE_HAS_UBOUND (flags ))
281
280
{
282
- Datum bound = PointerGetDatum (SendFunctionCall (& cache -> proc ,
281
+ Datum bound = PointerGetDatum (SendFunctionCall (& cache -> typioproc ,
283
282
upper .val ));
284
283
uint32 bound_len = VARSIZE (bound ) - VARHDRSZ ;
285
284
char * bound_data = VARDATA (bound );
@@ -309,6 +308,7 @@ get_range_io_data(FunctionCallInfo fcinfo, Oid rngtypid, IOFuncSelector func)
309
308
bool typbyval ;
310
309
char typalign ;
311
310
char typdelim ;
311
+ Oid typiofunc ;
312
312
313
313
cache = (RangeIOData * ) MemoryContextAlloc (fcinfo -> flinfo -> fn_mcxt ,
314
314
sizeof (RangeIOData ));
@@ -324,9 +324,9 @@ get_range_io_data(FunctionCallInfo fcinfo, Oid rngtypid, IOFuncSelector func)
324
324
& typalign ,
325
325
& typdelim ,
326
326
& cache -> typioparam ,
327
- & cache -> typiofunc );
327
+ & typiofunc );
328
328
329
- if (!OidIsValid (cache -> typiofunc ))
329
+ if (!OidIsValid (typiofunc ))
330
330
{
331
331
/* this could only happen for receive or send */
332
332
if (func == IOFunc_receive )
@@ -340,7 +340,7 @@ get_range_io_data(FunctionCallInfo fcinfo, Oid rngtypid, IOFuncSelector func)
340
340
errmsg ("no binary output function available for type %s" ,
341
341
format_type_be (cache -> typcache -> rngelemtype -> type_id ))));
342
342
}
343
- fmgr_info_cxt (cache -> typiofunc , & cache -> proc ,
343
+ fmgr_info_cxt (typiofunc , & cache -> typioproc ,
344
344
fcinfo -> flinfo -> fn_mcxt );
345
345
346
346
fcinfo -> flinfo -> fn_extra = (void * ) cache ;
0 commit comments