Hello

In my code I evaluate expr

 select array(select generate_series from generate_series(1,800)

my code
        var = (PLpgSQL_var *) (estate->datums[stmt->varno]);
        value = exec_eval_expr(estate, stmt->expr, &isnull, &valtype);
        exec_eval_cleanup(estate);


and iteration over array

 ndim = ARR_NDIM(value);
 dims = ARR_DIMS(value);
 nitems = ArrayGetNItems(ndim, dims);

  element_type = ARR_ELEMTYPE(value);
  p = ARR_DATA_PTR(value);

  get_typlenbyvalalign(element_type, &typlen, &typbyval, &typalign);

  for (i = 0; i < nitems; i++) // tak aby to zvladalo dimenze
  {
        Datum           itemvalue;

        itemvalue = fetch_att(p, typbyval, typlen);
        exec_assign_value(estate, (PLpgSQL_datum *) var, 
                itemvalue, element_type, &isnull);

                p = att_addlength(p, typlen, PointerGetDatum(p));
                p = (char *) att_align(p, typalign);

works fine, but from random index > 300 array is broken

NOTICE:  400
NOTICE:  401
NOTICE:  402
NOTICE:  403
NOTICE:  404
NOTICE:  405
NOTICE:  406
NOTICE:  407
NOTICE:  408
NOTICE:  409
NOTICE:  410
NOTICE:  411
NOTICE:  412
NOTICE:  413
NOTICE:  414
NOTICE:  415
NOTICE:  157207208
NOTICE:  16
NOTICE:  3486004
NOTICE:  419
NOTICE:  420
NOTICE:  421
NOTICE:  157207208
NOTICE:  16

Can you help me, what I do wrong?

Thank You
Pavel Stehule


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to