Re: C function working with input/ouput tables failed !

From: "M(dot) François =?iso-8859-1?b?QmVub+50LU1hcmFuZA==?=" <francois(dot)benoit-marand(at)univ-poitiers(dot)fr>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: C function working with input/ouput tables failed !
Date: 2008-07-24 11:35:08
Message-ID: 1216899308.488868ec75efa@webmail.univ-poitiers.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

FIRST PROBLEM IS SOLVED !

> First problem:
> When I try to get the input table, the first element is forgotten, then, the
> whole matrix is wrong! I have no idea of what happens…
>
> Example:
> Input table Matrix obtained
> By reading tuple by tuple
>
> 1 0 2 0 0 1 0 2
> 0 1 0 0 0 0 1 0
> 0 0 1 0 0 0 0 1
> 0 0 0 1 0 0 0 0
>
> If you are interested to read the code:
> Look at the function called: compute_puissance_table
> At the line containing : DBG(“Update of puissance_m”);
> --------------------

I change :
pm->data[i][j]= DatumGetInt32(SPI_getbinval(tuple,tupdesc, j, &isnull));
To :
pm->data[i][j]= DatumGetInt32(SPI_getbinval(tuple,tupdesc, j+1, &isnull));
In :
> for (i = 0; i < nl; i++)
> {
> DBG("Tuple number %i\n", i+1);
> HeapTuple tuple = tuptable->vals[i];
> for (j = 0; j < nc; j++)
> {
> pm->data[i][j]= DatumGetInt32(SPI_getbinval(tuple,
> tupdesc, j, &isnull));
> }
> }

In fact "SPI_getbinval(tuple,tupdesc, 0, &isnull));" returns NULL;

HOWEVER THE SECOND PROBLEM IS STILL OPEN !

Thanks for your reading!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tomasz Ostrowski 2008-07-24 11:47:31 Re: Equality search on timestamp value returns no rows
Previous Message Ivan Sergio Borgonovo 2008-07-24 11:08:54 Re: php + postgresql