strange tuple from ExecutorRun

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: strange tuple from ExecutorRun
Date: 2007-11-16 10:49:38
Message-ID: 162867790711160249t4dc97060hac858993f93d7e82@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
:consttype 23
: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?
:ressortgroupref 0
: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
}

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Markus Schiltknecht 2007-11-16 10:55:43 Re: High Availability, Load Balancing, and Replication Feature Matrix
Previous Message Sam Mason 2007-11-16 10:29:09 Re: Javascript support in the backend, i.e. PL/JS