Thread: SPI_exec - Trying to access SPI_tuptable - error of 'dereferencing pointer to incomplete type'
SPI_exec - Trying to access SPI_tuptable - error of 'dereferencing pointer to incomplete type'
From
Justin Clift
Date:
Hi all, I'm starting to program with the SPI interface with PG 7.0.3. I can get everything to work up until I use SPI_exec (successfully) using a query like 'SELECT foobar, baz1 from test1'. The return code from SPI_exec indicates SPI_OK_SELECT and the variable SPI_processed is 2 (meaning there are two 'results' available from the select); The trouble is that when I try and access the global variable SPI_tuptable, I get the error 'dereferencing pointer to incomplete type'. The offending line in question in my source code is : elog(NOTICE, "\nSPI_tuptable->alloced = %u\n\0", SPI_tuptable->alloced); The feeling I get is something is incorrect in the header files I'm using. So far I've been able to point to the installed include files (/opt/postgresql/include) and have everything work. Now that I'm getting errors I've decided to try pointing to the source code (/install/postgresql-7.0.3/src/include and /install/postgresql-7.0.3/src/backend) in the hope the include files are more complete. This is where I get the error "dereferencing pointer to incomplete type" with the above line of code. The exact command I'm using to compile is "gcc -fpic -shared -I/install/postgresql-7.0.3/src/include/ -I/install/postgresql-7.0.3/src/backend -L/install/postgresql-7.0.3/src/lib -o booking_sp_id.so booking_sp_id.c" Can someone please give me some pointers as to what I'm doing wrong? Regards and best wishes, Justin Clift Database Administrator