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! -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general