@@ -171,15 +171,15 @@ PLy_input_setup_tuple(PLyDatumToOb *arg, TupleDesc desc, PLyProcedure *proc)
171
171
172
172
/* Save pointer to tupdesc, but only if this is an anonymous record type */
173
173
if (arg -> typoid == RECORDOID && arg -> typmod < 0 )
174
- arg -> u . tuple .recdesc = desc ;
174
+ arg -> tuple .recdesc = desc ;
175
175
176
176
/* (Re)allocate atts array as needed */
177
- if (arg -> u . tuple .natts != desc -> natts )
177
+ if (arg -> tuple .natts != desc -> natts )
178
178
{
179
- if (arg -> u . tuple .atts )
180
- pfree (arg -> u . tuple .atts );
181
- arg -> u . tuple .natts = desc -> natts ;
182
- arg -> u . tuple .atts = (PLyDatumToOb * )
179
+ if (arg -> tuple .atts )
180
+ pfree (arg -> tuple .atts );
181
+ arg -> tuple .natts = desc -> natts ;
182
+ arg -> tuple .atts = (PLyDatumToOb * )
183
183
MemoryContextAllocZero (arg -> mcxt ,
184
184
desc -> natts * sizeof (PLyDatumToOb ));
185
185
}
@@ -188,7 +188,7 @@ PLy_input_setup_tuple(PLyDatumToOb *arg, TupleDesc desc, PLyProcedure *proc)
188
188
for (i = 0 ;i < desc -> natts ;i ++ )
189
189
{
190
190
Form_pg_attribute attr = TupleDescAttr (desc ,i );
191
- PLyDatumToOb * att = & arg -> u . tuple .atts [i ];
191
+ PLyDatumToOb * att = & arg -> tuple .atts [i ];
192
192
193
193
if (attr -> attisdropped )
194
194
continue ;
@@ -221,15 +221,15 @@ PLy_output_setup_tuple(PLyObToDatum *arg, TupleDesc desc, PLyProcedure *proc)
221
221
222
222
/* Save pointer to tupdesc, but only if this is an anonymous record type */
223
223
if (arg -> typoid == RECORDOID && arg -> typmod < 0 )
224
- arg -> u . tuple .recdesc = desc ;
224
+ arg -> tuple .recdesc = desc ;
225
225
226
226
/* (Re)allocate atts array as needed */
227
- if (arg -> u . tuple .natts != desc -> natts )
227
+ if (arg -> tuple .natts != desc -> natts )
228
228
{
229
- if (arg -> u . tuple .atts )
230
- pfree (arg -> u . tuple .atts );
231
- arg -> u . tuple .natts = desc -> natts ;
232
- arg -> u . tuple .atts = (PLyObToDatum * )
229
+ if (arg -> tuple .atts )
230
+ pfree (arg -> tuple .atts );
231
+ arg -> tuple .natts = desc -> natts ;
232
+ arg -> tuple .atts = (PLyObToDatum * )
233
233
MemoryContextAllocZero (arg -> mcxt ,
234
234
desc -> natts * sizeof (PLyObToDatum ));
235
235
}
@@ -238,7 +238,7 @@ PLy_output_setup_tuple(PLyObToDatum *arg, TupleDesc desc, PLyProcedure *proc)
238
238
for (i = 0 ;i < desc -> natts ;i ++ )
239
239
{
240
240
Form_pg_attribute attr = TupleDescAttr (desc ,i );
241
- PLyObToDatum * att = & arg -> u . tuple .atts [i ];
241
+ PLyObToDatum * att = & arg -> tuple .atts [i ];
242
242
243
243
if (attr -> attisdropped )
244
244
continue ;
@@ -277,9 +277,9 @@ PLy_output_setup_record(PLyObToDatum *arg, TupleDesc desc, PLyProcedure *proc)
277
277
* for the record type.
278
278
*/
279
279
arg -> typmod = desc -> tdtypmod ;
280
- if (arg -> u . tuple .recdesc &&
281
- arg -> u . tuple .recdesc -> tdtypmod != arg -> typmod )
282
- arg -> u . tuple .recdesc = NULL ;
280
+ if (arg -> tuple .recdesc &&
281
+ arg -> tuple .recdesc -> tdtypmod != arg -> typmod )
282
+ arg -> tuple .recdesc = NULL ;
283
283
284
284
/* Update derived data if necessary */
285
285
PLy_output_setup_tuple (arg ,desc ,proc );
@@ -343,11 +343,11 @@ PLy_output_setup_func(PLyObToDatum *arg, MemoryContext arg_mcxt,
343
343
{
344
344
/* Domain */
345
345
arg -> func = PLyObject_ToDomain ;
346
- arg -> u . domain .domain_info = NULL ;
346
+ arg -> domain .domain_info = NULL ;
347
347
/* Recursively set up conversion info for the element type */
348
- arg -> u . domain .base = (PLyObToDatum * )
348
+ arg -> domain .base = (PLyObToDatum * )
349
349
MemoryContextAllocZero (arg_mcxt ,sizeof (PLyObToDatum ));
350
- PLy_output_setup_func (arg -> u . domain .base ,arg_mcxt ,
350
+ PLy_output_setup_func (arg -> domain .base ,arg_mcxt ,
351
351
typentry -> domainBaseType ,
352
352
typentry -> domainBaseTypmod ,
353
353
proc );
@@ -359,11 +359,11 @@ PLy_output_setup_func(PLyObToDatum *arg, MemoryContext arg_mcxt,
359
359
arg -> func = PLySequence_ToArray ;
360
360
/* Get base type OID to insert into constructed array */
361
361
/* (note this might not be the same as the immediate child type) */
362
- arg -> u . array .elmbasetype = getBaseType (typentry -> typelem );
362
+ arg -> array .elmbasetype = getBaseType (typentry -> typelem );
363
363
/* Recursively set up conversion info for the element type */
364
- arg -> u . array .elm = (PLyObToDatum * )
364
+ arg -> array .elm = (PLyObToDatum * )
365
365
MemoryContextAllocZero (arg_mcxt ,sizeof (PLyObToDatum ));
366
- PLy_output_setup_func (arg -> u . array .elm ,arg_mcxt ,
366
+ PLy_output_setup_func (arg -> array .elm ,arg_mcxt ,
367
367
typentry -> typelem ,typmod ,
368
368
proc );
369
369
}
@@ -372,20 +372,20 @@ PLy_output_setup_func(PLyObToDatum *arg, MemoryContext arg_mcxt,
372
372
proc -> trftypes )))
373
373
{
374
374
arg -> func = PLyObject_ToTransform ;
375
- fmgr_info_cxt (trfuncid ,& arg -> u . transform .typtransform ,arg_mcxt );
375
+ fmgr_info_cxt (trfuncid ,& arg -> transform .typtransform ,arg_mcxt );
376
376
}
377
377
else if (typtype == TYPTYPE_COMPOSITE )
378
378
{
379
379
/* Named composite type, or RECORD */
380
380
arg -> func = PLyObject_ToComposite ;
381
381
/* We'll set up the per-field data later */
382
- arg -> u . tuple .recdesc = NULL ;
383
- arg -> u . tuple .typentry = typentry ;
384
- arg -> u . tuple .tupdescid = INVALID_TUPLEDESC_IDENTIFIER ;
385
- arg -> u . tuple .atts = NULL ;
386
- arg -> u . tuple .natts = 0 ;
382
+ arg -> tuple .recdesc = NULL ;
383
+ arg -> tuple .typentry = typentry ;
384
+ arg -> tuple .tupdescid = INVALID_TUPLEDESC_IDENTIFIER ;
385
+ arg -> tuple .atts = NULL ;
386
+ arg -> tuple .natts = 0 ;
387
387
/* Mark this invalid till needed, too */
388
- arg -> u . tuple .recinfunc .fn_oid = InvalidOid ;
388
+ arg -> tuple .recinfunc .fn_oid = InvalidOid ;
389
389
}
390
390
else
391
391
{
@@ -400,8 +400,8 @@ PLy_output_setup_func(PLyObToDatum *arg, MemoryContext arg_mcxt,
400
400
break ;
401
401
default :
402
402
arg -> func = PLyObject_ToScalar ;
403
- getTypeInputInfo (typeOid ,& typinput ,& arg -> u . scalar .typioparam );
404
- fmgr_info_cxt (typinput ,& arg -> u . scalar .typfunc ,arg_mcxt );
403
+ getTypeInputInfo (typeOid ,& typinput ,& arg -> scalar .typioparam );
404
+ fmgr_info_cxt (typinput ,& arg -> scalar .typfunc ,arg_mcxt );
405
405
break ;
406
406
}
407
407
}
@@ -476,9 +476,9 @@ PLy_input_setup_func(PLyDatumToOb *arg, MemoryContext arg_mcxt,
476
476
/* Standard array */
477
477
arg -> func = PLyList_FromArray ;
478
478
/* Recursively set up conversion info for the element type */
479
- arg -> u . array .elm = (PLyDatumToOb * )
479
+ arg -> array .elm = (PLyDatumToOb * )
480
480
MemoryContextAllocZero (arg_mcxt ,sizeof (PLyDatumToOb ));
481
- PLy_input_setup_func (arg -> u . array .elm ,arg_mcxt ,
481
+ PLy_input_setup_func (arg -> array .elm ,arg_mcxt ,
482
482
typentry -> typelem ,typmod ,
483
483
proc );
484
484
}
@@ -487,18 +487,18 @@ PLy_input_setup_func(PLyDatumToOb *arg, MemoryContext arg_mcxt,
487
487
proc -> trftypes )))
488
488
{
489
489
arg -> func = PLyObject_FromTransform ;
490
- fmgr_info_cxt (trfuncid ,& arg -> u . transform .typtransform ,arg_mcxt );
490
+ fmgr_info_cxt (trfuncid ,& arg -> transform .typtransform ,arg_mcxt );
491
491
}
492
492
else if (typtype == TYPTYPE_COMPOSITE )
493
493
{
494
494
/* Named composite type, or RECORD */
495
495
arg -> func = PLyDict_FromComposite ;
496
496
/* We'll set up the per-field data later */
497
- arg -> u . tuple .recdesc = NULL ;
498
- arg -> u . tuple .typentry = typentry ;
499
- arg -> u . tuple .tupdescid = INVALID_TUPLEDESC_IDENTIFIER ;
500
- arg -> u . tuple .atts = NULL ;
501
- arg -> u . tuple .natts = 0 ;
497
+ arg -> tuple .recdesc = NULL ;
498
+ arg -> tuple .typentry = typentry ;
499
+ arg -> tuple .tupdescid = INVALID_TUPLEDESC_IDENTIFIER ;
500
+ arg -> tuple .atts = NULL ;
501
+ arg -> tuple .natts = 0 ;
502
502
}
503
503
else
504
504
{
@@ -535,7 +535,7 @@ PLy_input_setup_func(PLyDatumToOb *arg, MemoryContext arg_mcxt,
535
535
default :
536
536
arg -> func = PLyUnicode_FromScalar ;
537
537
getTypeOutputInfo (typeOid ,& typoutput ,& typisvarlena );
538
- fmgr_info_cxt (typoutput ,& arg -> u . scalar .typfunc ,arg_mcxt );
538
+ fmgr_info_cxt (typoutput ,& arg -> scalar .typfunc ,arg_mcxt );
539
539
break ;
540
540
}
541
541
}
@@ -641,7 +641,7 @@ PLyBytes_FromBytea(PLyDatumToOb *arg, Datum d)
641
641
static PyObject *
642
642
PLyUnicode_FromScalar (PLyDatumToOb * arg ,Datum d )
643
643
{
644
- char * x = OutputFunctionCall (& arg -> u . scalar .typfunc ,d );
644
+ char * x = OutputFunctionCall (& arg -> scalar .typfunc ,d );
645
645
PyObject * r = PLyUnicode_FromString (x );
646
646
647
647
pfree (x );
@@ -656,7 +656,7 @@ PLyObject_FromTransform(PLyDatumToOb *arg, Datum d)
656
656
{
657
657
Datum t ;
658
658
659
- t = FunctionCall1 (& arg -> u . transform .typtransform ,d );
659
+ t = FunctionCall1 (& arg -> transform .typtransform ,d );
660
660
return (PyObject * )DatumGetPointer (t );
661
661
}
662
662
@@ -667,7 +667,7 @@ static PyObject *
667
667
PLyList_FromArray (PLyDatumToOb * arg ,Datum d )
668
668
{
669
669
ArrayType * array = DatumGetArrayTypeP (d );
670
- PLyDatumToOb * elm = arg -> u . array .elm ;
670
+ PLyDatumToOb * elm = arg -> array .elm ;
671
671
int ndim ;
672
672
int * dims ;
673
673
char * dataptr ;
@@ -817,7 +817,7 @@ PLyDict_FromTuple(PLyDatumToOb *arg, HeapTuple tuple, TupleDesc desc, bool inclu
817
817
PyObject * volatile dict ;
818
818
819
819
/* Simple sanity check that desc matches */
820
- Assert (desc -> natts == arg -> u . tuple .natts );
820
+ Assert (desc -> natts == arg -> tuple .natts );
821
821
822
822
dict = PyDict_New ();
823
823
if (dict == NULL )
@@ -827,9 +827,9 @@ PLyDict_FromTuple(PLyDatumToOb *arg, HeapTuple tuple, TupleDesc desc, bool inclu
827
827
{
828
828
int i ;
829
829
830
- for (i = 0 ;i < arg -> u . tuple .natts ;i ++ )
830
+ for (i = 0 ;i < arg -> tuple .natts ;i ++ )
831
831
{
832
- PLyDatumToOb * att = & arg -> u . tuple .atts [i ];
832
+ PLyDatumToOb * att = & arg -> tuple .atts [i ];
833
833
Form_pg_attribute attr = TupleDescAttr (desc ,i );
834
834
char * key ;
835
835
Datum vattr ;
@@ -971,22 +971,22 @@ PLyObject_ToComposite(PLyObToDatum *arg, PyObject *plrv,
971
971
{
972
972
desc = lookup_rowtype_tupdesc (arg -> typoid ,arg -> typmod );
973
973
/* We should have the descriptor of the type's typcache entry */
974
- Assert (desc == arg -> u . tuple .typentry -> tupDesc );
974
+ Assert (desc == arg -> tuple .typentry -> tupDesc );
975
975
/* Detect change of descriptor, update cache if needed */
976
- if (arg -> u . tuple .tupdescid != arg -> u . tuple .typentry -> tupDesc_identifier )
976
+ if (arg -> tuple .tupdescid != arg -> tuple .typentry -> tupDesc_identifier )
977
977
{
978
978
PLy_output_setup_tuple (arg ,desc ,
979
979
PLy_current_execution_context ()-> curr_proc );
980
- arg -> u . tuple .tupdescid = arg -> u . tuple .typentry -> tupDesc_identifier ;
980
+ arg -> tuple .tupdescid = arg -> tuple .typentry -> tupDesc_identifier ;
981
981
}
982
982
}
983
983
else
984
984
{
985
- desc = arg -> u . tuple .recdesc ;
985
+ desc = arg -> tuple .recdesc ;
986
986
if (desc == NULL )
987
987
{
988
988
desc = lookup_rowtype_tupdesc (arg -> typoid ,arg -> typmod );
989
- arg -> u . tuple .recdesc = desc ;
989
+ arg -> tuple .recdesc = desc ;
990
990
}
991
991
else
992
992
{
@@ -996,7 +996,7 @@ PLyObject_ToComposite(PLyObToDatum *arg, PyObject *plrv,
996
996
}
997
997
998
998
/* Simple sanity check on our caching */
999
- Assert (desc -> natts == arg -> u . tuple .natts );
999
+ Assert (desc -> natts == arg -> tuple .natts );
1000
1000
1001
1001
/*
1002
1002
* Convert, using the appropriate method depending on the type of the
@@ -1088,9 +1088,9 @@ PLyObject_ToScalar(PLyObToDatum *arg, PyObject *plrv,
1088
1088
1089
1089
str = PLyObject_AsString (plrv );
1090
1090
1091
- return InputFunctionCall (& arg -> u . scalar .typfunc ,
1091
+ return InputFunctionCall (& arg -> scalar .typfunc ,
1092
1092
str ,
1093
- arg -> u . scalar .typioparam ,
1093
+ arg -> scalar .typioparam ,
1094
1094
arg -> typmod );
1095
1095
}
1096
1096
@@ -1103,11 +1103,11 @@ PLyObject_ToDomain(PLyObToDatum *arg, PyObject *plrv,
1103
1103
bool * isnull ,bool inarray )
1104
1104
{
1105
1105
Datum result ;
1106
- PLyObToDatum * base = arg -> u . domain .base ;
1106
+ PLyObToDatum * base = arg -> domain .base ;
1107
1107
1108
1108
result = base -> func (base ,plrv ,isnull ,inarray );
1109
1109
domain_check (result ,* isnull ,arg -> typoid ,
1110
- & arg -> u . domain .domain_info ,arg -> mcxt );
1110
+ & arg -> domain .domain_info ,arg -> mcxt );
1111
1111
return result ;
1112
1112
}
1113
1113
@@ -1125,7 +1125,7 @@ PLyObject_ToTransform(PLyObToDatum *arg, PyObject *plrv,
1125
1125
return (Datum )0 ;
1126
1126
}
1127
1127
* isnull = false;
1128
- return FunctionCall1 (& arg -> u . transform .typtransform ,PointerGetDatum (plrv ));
1128
+ return FunctionCall1 (& arg -> transform .typtransform ,PointerGetDatum (plrv ));
1129
1129
}
1130
1130
1131
1131
@@ -1169,12 +1169,12 @@ PLySequence_ToArray(PLyObToDatum *arg, PyObject *plrv,
1169
1169
*/
1170
1170
PLySequence_ToArray_recurse (plrv ,& astate ,
1171
1171
& ndims ,dims ,1 ,
1172
- arg -> u . array .elm ,
1173
- arg -> u . array .elmbasetype );
1172
+ arg -> array .elm ,
1173
+ arg -> array .elmbasetype );
1174
1174
1175
1175
/* ensure we get zero-D array for no inputs, as per PG convention */
1176
1176
if (astate == NULL )
1177
- return PointerGetDatum (construct_empty_array (arg -> u . array .elmbasetype ));
1177
+ return PointerGetDatum (construct_empty_array (arg -> array .elmbasetype ));
1178
1178
1179
1179
for (int i = 0 ;i < ndims ;i ++ )
1180
1180
lbs [i ]= 1 ;
@@ -1289,8 +1289,8 @@ PLyUnicode_ToComposite(PLyObToDatum *arg, PyObject *string, bool inarray)
1289
1289
* Set up call data for record_in, if we didn't already. (We can't just
1290
1290
* use DirectFunctionCall, because record_in needs a fn_extra field.)
1291
1291
*/
1292
- if (!OidIsValid (arg -> u . tuple .recinfunc .fn_oid ))
1293
- fmgr_info_cxt (F_RECORD_IN ,& arg -> u . tuple .recinfunc ,arg -> mcxt );
1292
+ if (!OidIsValid (arg -> tuple .recinfunc .fn_oid ))
1293
+ fmgr_info_cxt (F_RECORD_IN ,& arg -> tuple .recinfunc ,arg -> mcxt );
1294
1294
1295
1295
str = PLyObject_AsString (string );
1296
1296
@@ -1334,7 +1334,7 @@ PLyUnicode_ToComposite(PLyObToDatum *arg, PyObject *string, bool inarray)
1334
1334
errhint ("To return a composite type in an array, return the composite type as a Python tuple, e.g., \"[('foo',)]\"." )));
1335
1335
}
1336
1336
1337
- return InputFunctionCall (& arg -> u . tuple .recinfunc ,
1337
+ return InputFunctionCall (& arg -> tuple .recinfunc ,
1338
1338
str ,
1339
1339
arg -> typoid ,
1340
1340
arg -> typmod );
@@ -1371,7 +1371,7 @@ PLyMapping_ToComposite(PLyObToDatum *arg, TupleDesc desc, PyObject *mapping)
1371
1371
1372
1372
key = NameStr (attr -> attname );
1373
1373
value = NULL ;
1374
- att = & arg -> u . tuple .atts [i ];
1374
+ att = & arg -> tuple .atts [i ];
1375
1375
PG_TRY ();
1376
1376
{
1377
1377
value = PyMapping_GetItemString (mapping ,key );
@@ -1451,7 +1451,7 @@ PLySequence_ToComposite(PLyObToDatum *arg, TupleDesc desc, PyObject *sequence)
1451
1451
}
1452
1452
1453
1453
value = NULL ;
1454
- att = & arg -> u . tuple .atts [i ];
1454
+ att = & arg -> tuple .atts [i ];
1455
1455
PG_TRY ();
1456
1456
{
1457
1457
value = PySequence_GetItem (sequence ,idx );
@@ -1511,7 +1511,7 @@ PLyGenericObject_ToComposite(PLyObToDatum *arg, TupleDesc desc, PyObject *object
1511
1511
1512
1512
key = NameStr (attr -> attname );
1513
1513
value = NULL ;
1514
- att = & arg -> u . tuple .atts [i ];
1514
+ att = & arg -> tuple .atts [i ];
1515
1515
PG_TRY ();
1516
1516
{
1517
1517
value = PyObject_GetAttrString (object ,key );