strange tuple from ExecutorRun - Mailing list pgsql-hackers

From Pavel Stehule
Subject strange tuple from ExecutorRun
Date
Msg-id 162867790711160249t4dc97060hac858993f93d7e82@mail.gmail.com
Whole thread Raw
Responses Re: strange tuple from ExecutorRun  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hello

I cannot find my bug. I would to get tuple via ExecutorRun. But it
works only with one field in target. With more fields I got last
fileld on first position and others fields are null. Can somebody help
me?

Pavel Stehule

postgres=# call print(10,20,30);
NOTICE:  nargs 3
NOTICE:  30 0
NOTICE:  2139062143 0
NOTICE:  2139062143 0



code:               dest = CreateDestReceiver(DestNone, NULL);
               ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
               qdesc = CreateQueryDesc(plan, ActiveSnapshot,
InvalidSnapshot,                                                      dest,
         paramLI, false);
 
               ExecutorStart(qdesc, 0);
               result = ExecutorRun(qdesc, ForwardScanDirection, 1L);
               tuple = ExecMaterializeSlot(result);
               values = (Datum *) palloc(nargs * sizeof(Datum));               nulls = (char *) palloc(nargs *
sizeof(char));
               /* copy typle to current context */               tuple = heap_copytuple(tuple);

               heap_deform_tuple(tuple, qdesc->tupDesc, values, nulls);
               for(i = 0; i < nargs; i++)               elog(NOTICE, "%d %d", values[i], nulls[i]);


NOTICE:  plan:
DETAIL:     {PLANNEDSTMT  :commandType 1  :canSetTag true  :planTree     {RESULT     :startup_cost 0.00     :total_cost
0.01    :plan_rows 1     :plan_width 0     :targetlist (        {TARGETENTRY        :expr           {CONST
:consttype23           :consttypmod -1           :constlen 4           :constbyval true           :constisnull false
      :constvalue 4 [ 10 0 0 0 ]           }        :resno 1        :resname ?Parameter?        :ressortgroupref 0
 :resorigtbl 0        :resorigcol 0        :resjunk false        }        {TARGETENTRY        :expr           {CONST
      :consttype 23           :consttypmod -1           :constlen 4           :constbyval true           :constisnull
false          :constvalue 4 [ 20 0 0 0 ]           }        :resno 1        :resname ?Parameter?
:ressortgroupref0        :resorigtbl 0        :resorigcol 0        :resjunk false        }        {TARGETENTRY
:expr          {CONST           :consttype 23           :consttypmod -1           :constlen 4           :constbyval
true          :constisnull false           :constvalue 4 [ 30 0 0 0 ]           }        :resno 1        :resname
?Parameter?       :ressortgroupref 0        :resorigtbl 0        :resorigcol 0        :resjunk false        }     )
:qual<>     :lefttree <>     :righttree <>     :initPlan <>     :extParam (b)     :allParam (b)     :resconstantqual <>
   }  :rtable <>  :resultRelations <>  :utilityStmt <>  :intoClause <>  :subplans <>  :rewindPlanIDs (b)
:returningLists<>  :rowMarks <>  :relationOids <>  :nParamExec 0  }
 


pgsql-hackers by date:

Previous
From: Sam Mason
Date:
Subject: Re: Javascript support in the backend, i.e. PL/JS
Next
From: "Pavel Stehule"
Date:
Subject: [solved] strange tuple from ExecutorRun