Hello, I am using PostgreSQL 8.2.4 with the 8.02.03.00 ODBC driver (unicode build), windows environment.
The program uses SQLBulkOperations to obtain from postgres new unique identifiers for a table before I insert the data that goes in that table. The program works and runs without error when the connection is in the default (auto-commit) mode; setting SQL_AUTOCOMMIT_OFF causes the program to crash dereferencing a NULL pointer internal to the ODBC driver. Following this message are excerpts code sufficient to replicate the problem, and some diagnostic logs. Thanks, Michael James CREATE TABLE CONCEPTS ( cid SERIAL, status INT, created DATE, modified DATE ); #define UNICODE #define _UNICODE #include <string.h> #include <stdlib.h> #include <tchar.h> #include <sql.h> #include <sqlext.h> #include <sqltypes.h> #include <sqlucode.h> struct sqlsession { SQLHENV envhandle; SQLHDBC dbhandle; }; static int initsqlsession(struct sqlsession *sql) { memset(sql, 0, sizeof *sql); SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &sql->envhandle); SQLSetEnvAttr(sql->envhandle, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0); SQLAllocHandle(SQL_HANDLE_DBC, sql->envhandle, &sql->dbhandle); return 0; } static int odbc_open(char *config, struct sqlsession *sql) { int x; initsqlsession(sql); x = SQLDriverConnectA( sql->dbhandle, 0, config, strlen(config), NULL, 0, NULL, SQL_DRIVER_NOPROMPT); switch (x) { case SQL_SUCCESS_WITH_INFO: case SQL_SUCCESS: break; default: finisqlsession(sql); exit(EXIT_FAILURE); return 0; } #if 1 // change this to if 0 to see this code work correctly x = SQLSetConnectAttr(sql->dbhandle, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); diagnose(SQL_HANDLE_DBC, sql->dbhandle); #endif return 1; } #define SET(attr, val) x=SQLSetStmtAttr(hstmt, SQL_ATTR_ ## attr, (SQLPOINTER)(val), 0), diagnose(SQL_HANDLE_STMT, hstmt) #define BIND(i, type, record, field) \ x = SQLBindCol(hstmt, (i), (type), &(record)->field, sizeof (record)->field, &(record)->ind ## field), \ diagnose(SQL_HANDLE_STMT, hstmt) static int odbc_getuniqueid(int isconcept, void *_) { struct sqlsession *sql = _; struct uidgen_row row; SQLHSTMT hstmt; SQLRETURN x; SQLUSMALLINT rowstatus; SQLAllocHandle(SQL_HANDLE_STMT, sql->dbhandle, &hstmt); SET(CURSOR_TYPE, SQL_CURSOR_KEYSET_DRIVEN); SET(USE_BOOKMARKS, SQL_UB_VARIABLE); SET(CONCURRENCY, SQL_CONCUR_LOCK); SET(ROW_STATUS_PTR, &rowstatus); SET(ROW_BIND_TYPE, sizeof (struct uidgen_row)); SET(ROW_ARRAY_SIZE, 1); BIND(0, SQL_C_VARBOOKMARK, &row, bookmark); BIND(1, SQL_C_ULONG, &row, uid); BIND(2, SQL_C_ULONG, &row, status); x = SQLExecDirect(hstmt, _T("SELECT cid, status FROM CONCEPTS WHERE FALSE"), SQL_NTS); x = SQLFetchScroll(hstmt, SQL_FETCH_FIRST, 0); memset(&row, 0, sizeof row); row.indbookmark = sizeof row.bookmark; row.indstatus = sizeof row.status; row.induid = SQL_COLUMN_IGNORE; row.status = STATUS_NOTREADY; x = SQLBulkOperations(hstmt, SQL_ADD); row.induid = sizeof row.uid; x = SQLBulkOperations(hstmt, SQL_FETCH_BY_BOOKMARK); // ** CRASH HERE SQLFreeHandle(SQL_HANDLE_STMT, hstmt); return row.uid; } char *mydsn = "DSN=psql local;DATABASE=bugtest;SERVER=localhost;PORT=5432;UID=mixe;PWD=somepass;SSLmode=disable;ReadOnly=0;Protocol=7.4;FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0;ShowSystemTables=0;ConnSettings=;Fetch=100;Socket=4096;UnknownSizes=0;MaxVarcharSize=255;MaxLongVarcharSize=8190;Debug=1;CommLog=0;Optimizer=1;Ksqo=1;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;BoolsAsChar=1;Parse=0;CancelAsFreeStmt=0;ExtraSysTablePrefixes=dd_;;LFConversion=1;UpdatableCursors=1;DisallowPremature=0;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinary=0;UseServerSidePrepare=0;LowerCaseIdentifier=0;XaOpt=1" int main(void) { struct sqlsession sql; memset(&sql, 0, sizeof sql); odbc_open(mydsn, &sql); odbc_getuniqueid(); } And, here are some excerpts from the debug log that the ODBC driver creates, first when it works (with auto commit): [3744-1.702][[SQLBulkOperations]] Handle=06169720 4 [3744-1.702]PGAPI_BulkOperations operation = 4 [3744-1.702]PGAPI_SetConnectOption: entering fOption = 102 vParam = 0 [3744-1.712]PGAPI_SetConnectOption: AUTOCOMMIT: transact_status=1, vparam=0 [3744-1.712]POS ADD fi=06169B08 ti=06169C80 [3744-1.712]PGAPI_AllocStmt: entering... [3744-1.712]**** PGAPI_AllocStmt: hdbc = 06165A80, stmt = 0616A1B8 [3744-1.712]CC_add_statement: self=06165A80, stmt=0616A1B8 [3744-1.712]0 used=-6 [3744-1.712]1 used=4 [3744-1.712]PGAPI_BindParameter: entering... [3744-1.712]extend_parameter_bindings: entering ... self=0616A2B8, parameters_allocated=0, num_params=1,00000000 [3744-1.712]exit extend_parameter_bindings=0616F110 [3744-1.712]extend_iparameter_bindings: entering ... self=0616A2F8, parameters_allocated=0, num_params=1 [3744-1.712]exit extend_iparameter_bindings=0616F140 [3744-1.712]extend_putdata_info: entering ... self=0616A35C, parameters_allocated=0, num_params=1 [3744-1.712]exit extend_putdata_info=06169A08 [3744-1.712]PGAPI_BindParameter: ipar=0, paramType=1, fCType=-18, fSqlType=4, cbColDef=10, ibScale=0,[3744-1.712]rgbValue=00124C6C, pcbValue = 00124C74, data_at_exec = 0 [3744-1.712]addstr=insert into "public"."concepts" ("status") values (?) returning ctid [3744-1.712]PGAPI_ExecDirect: entering...0 [3744-1.712]SC_recycle_statement: self= 0616A1B8 [3744-1.712]**** PGAPI_ExecDirect: hstmt=0616A1B8, statement='insert into "public"."concepts" ("status") values (?) returning ctid' [3744-1.712]PGAPI_ExecDirect: calling PGAPI_Execute... [3744-1.712]PGAPI_Execute: entering...0 [3744-1.712]PGAPI_Execute: clear errors... [3744-1.712]PGAPI_NumParams: entering... [3744-1.712]SC_scanQueryAndCountParams: entering... [3744-1.712]prepareParameters 0 end [3744-1.712]SC_recycle_statement: self= 0616A1B8 [3744-1.712]Exec_with_parameters_resolved: copying statement params: trans_status=0, len=68, stmt='insert into "public"."concepts" ("status") values (?) returning ctid' [3744-1.712]ResolveOneParam: from(fcType)=-18, to(fSqlType)=4 [3744-1.712]cvt_null_date_string=0 pgtype=23 buf=00000000 [3744-1.712] stmt_with_params = 'insert into "public"."concepts" ("status") values (1) returning ctid' [3744-1.712]about to begin SC_execute [3744-1.712] about to begin a transaction on statement = 0616A1B8 [3744-1.712] it's NOT a select statement: stmt=0616A1B8 [3744-1.722]send_query(): conn=06165A80, query='insert into "public"."concepts" ("status") values (1) returning ctid' [3744-1.722]send_query: done sending query 80bytes flushed [3744-1.722]in QR_Constructor [3744-1.722]exit QR_Constructor [3744-1.722]read 79, global_socket_buffersize=4096 [3744-1.722]send_query: got id = 'C' [3744-1.722]send_query: ok - 'C' - BEGIN [3744-1.722]send_query: setting cmdbuffer = 'BEGIN' [3744-1.722]send_query: got id = 'T' [3744-1.722]QR_fetch_tuples: cursor = '', self->cursor=00000000 [3744-1.722]num_fields = 1 [3744-1.722]READING ATTTYPMOD [3744-1.722]CI_read_fields: fieldname='ctid', adtid=27, adtsize=6, atttypmod=-1 (rel,att)=(16492,65535) [3744-1.722]QR_fetch_tuples: past CI_read_fields: num_fields = 1 [3744-1.722]MALLOC: tuple_size = 100, size = 800 [3744-1.722]QR_next_tuple: inTuples = true, falling through: fcount = 0, fetch_number = 0 [3744-1.722]qresult: len=5, buffer='(0,6)' [3744-1.722]end of tuple list -- setting inUse to false: this = 06169D88 INSERT 0 1 [3744-1.722]_QR_next_tuple: 'C' fetch_total = 1 & this_fetch = 1 [3744-1.722]QR_next_tuple: backend_rows < CACHE_SIZE: brows = 0, cache_size = 0 [3744-1.722]QR_next_tuple: reached eof now [3744-1.722]send_query: got id = 'Z' [3744-1.722]extend_column_bindings: entering ... self=0616A240, bindings_allocated=0, num_columns=1 [3744-1.722]exit extend_column_bindings=0616A478 [3744-1.722]SC_set_Result(616a1b8, 6169d88)[3744-1.722]QResult: enter DESTRUCTOR [3744-1.722]retval=0 [3744-1.722]PGAPI_ExecDirect: returned 0 from PGAPI_Execute [3744-1.722]pos_add_callback in ret=0 [3744-1.722]positioned new ti=06169C80 [3744-1.722]selstr=SELECT cid, status , "ctid" FROM CONCEPTS where ctid = '(0,6)' [3744-1.722]send_query(): conn=06165A80, query='SELECT cid, status , "ctid" FROM CONCEPTS where ctid = '(0,6)' ' [3744-1.722]send_query: done sending query 70bytes flushed [3744-1.722]in QR_Constructor [3744-1.722]exit QR_Constructor [3744-1.722]read 121, global_socket_buffersize=4096 [3744-1.722]send_query: got id = 'T' [3744-1.722]QR_fetch_tuples: cursor = '', self->cursor=00000000 [3744-1.732]num_fields = 3 [3744-1.732]READING ATTTYPMOD [3744-1.732]CI_read_fields: fieldname='cid', adtid=23, adtsize=4, atttypmod=-1 (rel,att)=(16492,1) [3744-1.732]READING ATTTYPMOD [3744-1.732]CI_read_fields: fieldname='status', adtid=23, adtsize=4, atttypmod=-1 (rel,att)=(16492,2) [3744-1.732]READING ATTTYPMOD [3744-1.732]CI_read_fields: fieldname='ctid', adtid=27, adtsize=6, atttypmod=-1 (rel,att)=(16492,65535) [3744-1.732]QR_fetch_tuples: past CI_read_fields: num_fields = 3 [3744-1.732]MALLOC: tuple_size = 100, size = 2400 [3744-1.732]QR_next_tuple: inTuples = true, falling through: fcount = 0, fetch_number = 0 [3744-1.732]qresult: len=1, buffer='6' [3744-1.732]qresult: len=1, buffer='1' [3744-1.732]qresult: len=5, buffer='(0,6)' [3744-1.732]end of tuple list -- setting inUse to false: this = 0616A8D8 SELECT [3744-1.732]_QR_next_tuple: 'C' fetch_total = 1 & this_fetch = 1 [3744-1.732]QR_next_tuple: backend_rows < CACHE_SIZE: brows = 0, cache_size = 0 [3744-1.732]QR_next_tuple: reached eof now [3744-1.732]send_query: got id = 'Z' [3744-1.732]QResult: enter DESTRUCTOR [3744-1.732]QResult: in QR_close_result [3744-1.732]QResult: free memory in, fcount=1 [3744-1.732]QResult: free memory out [3744-1.732]QResult: enter DESTRUCTOR [3744-1.732]QResult: exit close_result [3744-1.732]QResult: exit DESTRUCTOR [3744-1.732]copy_and_convert: field_type = 23, fctype = -2, value = '1', cbValueMax=16 [3744-1.732]PGAPI_FreeStmt: entering...hstmt=0616A1B8, fOption=1 [3744-1.732]QResult: enter DESTRUCTOR [3744-1.732]QResult: in QR_close_result [3744-1.732]QResult: free memory in, fcount=1 [3744-1.732]QResult: free memory out [3744-1.732]QResult: enter DESTRUCTOR [3744-1.732]QResult: exit close_result [3744-1.732]QResult: exit DESTRUCTOR [3744-1.732]SC_init_Result(616a1b8)[3744-1.732]SC_Destructor: self=0616A1B8, self->result=00000000, self->hdbc=06165A80 [3744-1.732]reset_a_column_binding: entering ... self=0616A240, bindings_allocated=1, icol=1 [3744-1.732]APD_free_params: ENTER, self=0616A2B8 [3744-1.732]APD_free_params: EXIT [3744-1.732]IPD_free_params: ENTER, self=0616A2F8 [3744-1.732]IPD_free_params: EXIT [3744-1.732]PDATA_free_params: ENTER, self=0616A35C [3744-1.742]PDATA_free_params: EXIT [3744-1.742]SC_Destructor: EXIT [3744-1.742]PGAPI_SetConnectOption: entering fOption = 102 vParam = 1 [3744-1.742]send_query(): conn=06165A80, query='COMMIT' [3744-1.742]send_query: done sending query 12bytes flushed [3744-1.742]in QR_Constructor [3744-1.742]exit QR_Constructor [3744-1.742]read -1, global_socket_buffersize=4096 [3744-1.742]Lasterror=10035 [3744-1.742]read 18, global_socket_buffersize=4096 [3744-1.742]send_query: got id = 'C' [3744-1.742]send_query: ok - 'C' - COMMIT [3744-1.742]send_query: setting cmdbuffer = 'COMMIT' [3744-1.742]send_query: returning res = 06169D88 [3744-1.742]send_query: got id = 'Z' [3744-1.742]CC_commit: sending COMMIT! [3744-1.742]QResult: enter DESTRUCTOR [3744-1.742]QResult: in QR_close_result [3744-1.742]QResult: free memory in, fcount=0 [3744-1.742]QResult: free memory out [3744-1.742]QResult: enter DESTRUCTOR [3744-1.742]QResult: exit close_result [3744-1.742]QResult: exit DESTRUCTOR [3744-1.742]PGAPI_SetConnectOption: AUTOCOMMIT: transact_status=0, vparam=1 [3744-1.742][[SQLBulkOperations]] Handle=06169720 7 [3744-1.742]PGAPI_BulkOperations operation = 7 [3744-1.742]positioned load fi=06169B08 ti=06169C80 [3744-1.742]selstr=SELECT cid, status , "ctid" FROM CONCEPTS where ctid = currtid2('"public"."concepts"', '(0, 6)') [3744-1.742]send_query(): conn=06165A80, query='SELECT cid, status , "ctid" FROM CONCEPTS where ctid = currtid2('"public"."concepts"', '(0, 6)') ' [3744-1.742]send_query: done sending query 104bytes flushed [3744-1.742]in QR_Constructor [3744-1.742]exit QR_Constructor [3744-1.742]read 121, global_socket_buffersize=4096 [3744-1.742]send_query: got id = 'T' [3744-1.742]QR_fetch_tuples: cursor = '', self->cursor=00000000 [3744-1.742]num_fields = 3 [3744-1.742]READING ATTTYPMOD [3744-1.742]CI_read_fields: fieldname='cid', adtid=23, adtsize=4, atttypmod=-1 (rel,att)=(16492,1) [3744-1.742]READING ATTTYPMOD [3744-1.742]CI_read_fields: fieldname='status', adtid=23, adtsize=4, atttypmod=-1 (rel,att)=(16492,2) [3744-1.742]READING ATTTYPMOD [3744-1.742]CI_read_fields: fieldname='ctid', adtid=27, adtsize=6, atttypmod=-1 (rel,att)=(16492,65535) [3744-1.752]QR_fetch_tuples: past CI_read_fields: num_fields = 3 [3744-1.752]MALLOC: tuple_size = 100, size = 2400 [3744-1.752]QR_next_tuple: inTuples = true, falling through: fcount = 0, fetch_number = 0 [3744-1.752]qresult: len=1, buffer='6' [3744-1.752]qresult: len=1, buffer='1' [3744-1.752]qresult: len=5, buffer='(0,6)' [3744-1.752]end of tuple list -- setting inUse to false: this = 06275998 SELECT [3744-1.752]_QR_next_tuple: 'C' fetch_total = 1 & this_fetch = 1 [3744-1.752]QR_next_tuple: backend_rows < CACHE_SIZE: brows = 0, cache_size = 0 [3744-1.752]QR_next_tuple: reached eof now [3744-1.752]send_query: got id = 'Z' [3744-1.752]QResult: enter DESTRUCTOR [3744-1.752]QResult: in QR_close_result [3744-1.752]QResult: free memory in, fcount=1 [3744-1.752]QResult: free memory out [3744-1.752]QResult: enter DESTRUCTOR [3744-1.752]QResult: exit close_result [3744-1.752]QResult: exit DESTRUCTOR [3744-1.752]fetch_cursor=0, 0616F050->total_read=0 [3744-1.752]**** SC_fetch: non-cursor_result [3744-1.752]copy_and_convert: field_type = 0, fctype = -18, value = '1', cbValueMax=0 [3744-1.752]extend_getdata_info: entering ... self=06169884, gdata_allocated=2, num_columns=3 [3744-1.752]exit extend_gdata_info=061699D8 [3744-1.752]fetch: cols=2, lf=0, opts = 061697A8, opts->bindings = 0616A158, buffer[] = 00124C68 [3744-1.752]type = 23 [3744-1.752]value = '6' [3744-1.752]copy_and_convert: field_type = 23, fctype = -18, value = '6', cbValueMax=4 [3744-1.752]copy_and_convert: retval = 0 [3744-1.752]fetch: cols=2, lf=1, opts = 061697A8, opts->bindings = 0616A158, buffer[] = 00124C6C [3744-1.752]type = 23 [3744-1.752]value = '1' [3744-1.752]copy_and_convert: field_type = 23, fctype = -18, value = '1', cbValueMax=4 [3744-1.752]copy_and_convert: retval = 0 [3744-1.752][[SQLFreeHandle]][3744-1.752]PGAPI_FreeStmt: entering...hstmt=06169720, fOption=1 [3744-1.752]QResult: enter DESTRUCTOR [3744-1.752]QResult: in QR_close_result [3744-1.752]QResult: free memory in, fcount=1 [3744-1.752]QResult: free memory out [3744-1.752]QResult: enter DESTRUCTOR [3744-1.752]QResult: exit close_result [3744-1.762]QResult: exit DESTRUCTOR [3744-1.762]SC_init_Result(6169720)[3744-1.762]SC_Destructor: self=06169720, self->result=00000000, self->hdbc=06165A80 [3744-1.762]reset_a_column_binding: entering ... self=061697A8, bindings_allocated=3, icol=1 [3744-1.762]reset_a_column_binding: entering ... self=061697A8, bindings_allocated=3, icol=2 [3744-1.762]reset_a_column_binding: entering ... self=061697A8, bindings_allocated=3, icol=3 [3744-1.762]APD_free_params: ENTER, self=06169820 [3744-1.762]IPD_free_params: ENTER, self=06169860 [3744-1.762]PDATA_free_params: ENTER, self=061698C4 [3744-1.762]SC_Destructor: EXIT and now when it crashes (without auto commit): [292-31.825][[SQLBulkOperations]] Handle=055C9720 4 [292-31.825]PGAPI_BulkOperations operation = 4 [292-31.825]POS ADD fi=055C9B08 ti=055C9C80 [292-31.825]PGAPI_AllocStmt: entering... [292-31.825]**** PGAPI_AllocStmt: hdbc = 055C5A80, stmt = 055CA1B8 [292-31.825]CC_add_statement: self=055C5A80, stmt=055CA1B8 [292-31.825]0 used=-6 [292-31.825]1 used=4 [292-31.825]PGAPI_BindParameter: entering... [292-31.825]extend_parameter_bindings: entering ... self=055CA2B8, parameters_allocated=0, num_params=1,00000000 [292-31.825]exit extend_parameter_bindings=055CF110 [292-31.825]extend_iparameter_bindings: entering ... self=055CA2F8, parameters_allocated=0, num_params=1 [292-31.825]exit extend_iparameter_bindings=055CF140 [292-31.825]extend_putdata_info: entering ... self=055CA35C, parameters_allocated=0, num_params=1 [292-31.835]exit extend_putdata_info=055C9A08 [292-31.835]PGAPI_BindParameter: ipar=0, paramType=1, fCType=-18, fSqlType=4, cbColDef=10, ibScale=0,[292-31.835]rgbValue=00124C6C, pcbValue = 00124C74, data_at_exec = 0 [292-31.835]addstr=insert into "public"."concepts" ("status") values (?) returning ctid [292-31.835]PGAPI_ExecDirect: entering...0 [292-31.835]SC_recycle_statement: self= 055CA1B8 [292-31.835]**** PGAPI_ExecDirect: hstmt=055CA1B8, statement='insert into "public"."concepts" ("status") values (?) returning ctid' [292-31.835]PGAPI_ExecDirect: calling PGAPI_Execute... [292-31.835]PGAPI_Execute: entering...0 [292-31.835]PGAPI_Execute: clear errors... [292-31.835]PGAPI_NumParams: entering... [292-31.835]SC_scanQueryAndCountParams: entering... [292-31.845]prepareParameters 0 end [292-31.845]SC_recycle_statement: self= 055CA1B8 [292-31.845]Exec_with_parameters_resolved: copying statement params: trans_status=2, len=68, stmt='insert into "public"."concepts" ("status") values (?) returning ctid' [292-31.845]ResolveOneParam: from(fcType)=-18, to(fSqlType)=4 [292-31.845]cvt_null_date_string=0 pgtype=23 buf=00000000 [292-31.845] stmt_with_params = 'insert into "public"."concepts" ("status") values (1) returning ctid' [292-31.845]about to begin SC_execute [292-31.845] it's NOT a select statement: stmt=055CA1B8 [292-31.845]send_query(): conn=055C5A80, query='insert into "public"."concepts" ("status") values (1) returning ctid' [292-31.845]send_query(): conn=055C5A80, query='SAVEPOINT _EXEC_SVP_055C9720' [292-31.845]send_query: done sending query 34bytes flushed [292-31.855]in QR_Constructor [292-31.855]exit QR_Constructor [292-31.855]read 21, global_socket_buffersize=4096 [292-31.855]send_query: got id = 'C' [292-31.855]send_query: ok - 'C' - SAVEPOINT [292-31.855]send_query: setting cmdbuffer = 'SAVEPOINT' [292-31.855]send_query: returning res = 055C9D88 [292-31.855]send_query: got id = 'Z' [292-31.855]QResult: enter DESTRUCTOR [292-31.855]QResult: in QR_close_result [292-31.855]QResult: free memory in, fcount=0 [292-31.855]QResult: free memory out [292-31.855]QResult: enter DESTRUCTOR [292-31.855]QResult: exit close_result [292-31.855]QResult: exit DESTRUCTOR [292-31.855]send_query: done sending query 74bytes flushed [292-31.865]in QR_Constructor [292-31.865]exit QR_Constructor [292-31.865]read 68, global_socket_buffersize=4096 [292-31.865]send_query: got id = 'T' [292-31.865]QR_fetch_tuples: cursor = '', self->cursor=00000000 [292-31.865]num_fields = 1 [292-31.865]READING ATTTYPMOD [292-31.865]CI_read_fields: fieldname='ctid', adtid=27, adtsize=6, atttypmod=-1 (rel,att)=(16492,65535) [292-31.865]QR_fetch_tuples: past CI_read_fields: num_fields = 1 [292-31.865]MALLOC: tuple_size = 100, size = 800 [292-31.865]QR_next_tuple: inTuples = true, falling through: fcount = 0, fetch_number = 0 [292-31.865]qresult: len=5, buffer='(0,1)' [292-31.865]end of tuple list -- setting inUse to false: this = 055CA3F8 INSERT 0 1 [292-31.865]_QR_next_tuple: 'C' fetch_total = 1 & this_fetch = 1 [292-31.865]QR_next_tuple: backend_rows < CACHE_SIZE: brows = 0, cache_size = 0 [292-31.875]QR_next_tuple: reached eof now [292-31.875]send_query: got id = 'Z' [292-31.875]extend_column_bindings: entering ... self=055CA240, bindings_allocated=0, num_columns=1 [292-31.875]exit extend_column_bindings=055C9E08 [292-31.875]SC_set_Result(55ca1b8, 55ca3f8)[292-31.875]QResult: enter DESTRUCTOR [292-31.875]retval=0 [292-31.875]PGAPI_ExecDirect: returned 0 from PGAPI_Execute [292-31.885]pos_add_callback in ret=0 [292-31.885]positioned new ti=055C9C80 [292-31.885]selstr=SELECT cid, status , "ctid" FROM CONCEPTS where ctid = '(0,1)' [292-31.885]send_query(): conn=055C5A80, query='SELECT cid, status , "ctid" FROM CONCEPTS where ctid = '(0,1)' ' [292-31.885]send_query: done sending query 70bytes flushed [292-31.885]in QR_Constructor [292-31.885]exit QR_Constructor [292-31.885]read 121, global_socket_buffersize=4096 [292-31.885]send_query: got id = 'T' [292-31.885]QR_fetch_tuples: cursor = '', self->cursor=00000000 [292-31.885]num_fields = 3 [292-31.885]READING ATTTYPMOD [292-31.885]CI_read_fields: fieldname='cid', adtid=23, adtsize=4, atttypmod=-1 (rel,att)=(16492,1) [292-31.895]READING ATTTYPMOD [292-31.895]CI_read_fields: fieldname='status', adtid=23, adtsize=4, atttypmod=-1 (rel,att)=(16492,2) [292-31.895]READING ATTTYPMOD [292-31.895]CI_read_fields: fieldname='ctid', adtid=27, adtsize=6, atttypmod=-1 (rel,att)=(16492,65535) [292-31.895]QR_fetch_tuples: past CI_read_fields: num_fields = 3 [292-31.895]MALLOC: tuple_size = 100, size = 2400 [292-31.895]QR_next_tuple: inTuples = true, falling through: fcount = 0, fetch_number = 0 [292-31.895]qresult: len=1, buffer='1' [292-31.895]qresult: len=1, buffer='1' [292-31.895]qresult: len=5, buffer='(0,1)' [292-31.895]end of tuple list -- setting inUse to false: this = 055CA8D8 SELECT [292-31.895]_QR_next_tuple: 'C' fetch_total = 1 & this_fetch = 1 [292-31.905]QR_next_tuple: backend_rows < CACHE_SIZE: brows = 0, cache_size = 0 [292-31.905]QR_next_tuple: reached eof now [292-31.905]send_query: got id = 'Z' [292-31.905]QResult: enter DESTRUCTOR [292-31.905]QResult: in QR_close_result [292-31.905]QResult: free memory in, fcount=1 [292-31.905]QResult: free memory out [292-31.905]QResult: enter DESTRUCTOR [292-31.905]QResult: exit close_result [292-31.905]QResult: exit DESTRUCTOR [292-31.905]copy_and_convert: field_type = 23, fctype = -2, value = '1', cbValueMax=16 [292-31.905]PGAPI_FreeStmt: entering...hstmt=055CA1B8, fOption=1 [292-31.905]QResult: enter DESTRUCTOR [292-31.905]QResult: in QR_close_result [292-31.905]QResult: free memory in, fcount=1 [292-31.905]QResult: free memory out [292-31.905]QResult: enter DESTRUCTOR [292-31.915]QResult: exit close_result [292-31.915]QResult: exit DESTRUCTOR [292-31.915]SC_init_Result(55ca1b8)[292-31.915]SC_Destructor: self=055CA1B8, self->result=00000000, self->hdbc=055C5A80 [292-31.915]reset_a_column_binding: entering ... self=055CA240, bindings_allocated=1, icol=1 [292-31.915]APD_free_params: ENTER, self=055CA2B8 [292-31.915]APD_free_params: EXIT [292-31.915]IPD_free_params: ENTER, self=055CA2F8 [292-31.915]IPD_free_params: EXIT [292-31.915]PDATA_free_params: ENTER, self=055CA35C [292-31.915]PDATA_free_params: EXIT [292-31.915]SC_Destructor: EXIT [292-31.915]send_query(): conn=055C5A80, query='RELEASE _EXEC_SVP_055C9720' [292-31.915]send_query: done sending query 32bytes flushed [292-31.915]in QR_Constructor [292-31.925]exit QR_Constructor [292-31.925]read 19, global_socket_buffersize=4096 [292-31.925]send_query: got id = 'C' [292-31.925]send_query: ok - 'C' - RELEASE [292-31.925]send_query: setting cmdbuffer = 'RELEASE' [292-31.925]send_query: returning res = 055C9D88 [292-31.935]send_query: got id = 'Z' [292-31.935]QResult: enter DESTRUCTOR [292-31.935]QResult: in QR_close_result [292-31.935]QResult: free memory in, fcount=0 [292-31.935]QResult: free memory out [292-31.935]QResult: enter DESTRUCTOR [292-31.935]QResult: exit close_result [292-31.935]QResult: exit DESTRUCTOR [292-36.782][[SQLBulkOperations]] Handle=055C9720 7 [292-36.782]PGAPI_BulkOperations operation = 7 [292-36.782]positioned load fi=055C9B08 ti=055C9C80 [292-36.782]The tuple is currently being added and can't use ctid [292-36.782]STATEMENT ERROR: func=positioned_load, desc='', errnum=8, errmsg='can't find the add and updating row because of the lack of oid' [292-36.782]CONN ERROR: func=positioned_load, desc='', errnum=0, errmsg='(NULL)' ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend