Hi,
I have a problem with changing views in Access. Of course I designed the
proper rules (CREATE RULE upd_viewfoo AS ON UPDATE TO viewfoo DO INSTEAD
UPDATE tablebar SET ..... ) and it all works when I update the view
manually (i.e. in a terminal).
However, when I try to update the view via ODBC (in Access 97) something
goes wrong. Access gives me a basic error ("This record has been changed
by another user, blablabla") that doesn't make sense in my opinion. What
does make sense, however, is the my.log: among all the lines of code, I
found the following:
send_query(): conn=116763028, query='UPDATE ....update-query....'
send_query: done sending query
<cut lots of lines>
send_query: got id = 'C'
send_query: ok - 'C' - BEGIN
send_query: setting cmdbuffer = 'BEGIN'
send_query: got id = 'P'
send_query: got id = 'C'
send_query: ok - 'C' - UPDATE 0
send_query: setting cmdbuffer = 'UPDATE 0'
send_query: returning res = 117836720
send_query: got id = 'Z'
PGAPI_ExecDirect: returned 0 from PGAPI_Execute
(------- watch this: -------------)
[SQLRowCount]PGAPI_RowCount: entering...
*** msg = 'UPDATE 0'
**** PGAPI_RowCount(): THE ROWS: *pcrow = 0
[SQLCancel]PGAPI_Cancel: entering...
(---------------------------------)
PGAPI_FreeStmt: entering...hstmt=117838192, fOption=0
recycle statement: self= 117838192
QResult: in DESTRUCTOR
QResult: free memory in, fcount=0
QResult: free memory out
QResult: exit DESTRUCTOR
APD_free_params: ENTER, self=117838292
APD_free_params: EXIT
PGAPI_Cancel: PGAPI_FreeStmt returned 0
[SQLFreeStmt]PGAPI_FreeStmt: entering...hstmt=117838192, fOption=1
SC_Destructor: self=117838192, self->result=0, self->hdbc=116763028
APD_free_params: ENTER, self=117838292
APD_free_params: EXIT
SC_Destructor: EXIT
[SQLTransact]entering PGAPI_Transact: hdbc=116763028, henv=0
PGAPI_Transact: sending on conn 116763028 'ROLLBACK'
send_query(): conn=116763028, query='ROLLBACK'
send_query: done sending query
IMHO, it seems the "UPDATE 0" returned by postgresql (as it also does
on a manual update, since this is default when updating a view) makes
the ODBC driver think 0 rows are updated, the query would be
unsuccesfull and triggers the ROLLBACK and gives me the error in Access.
Somehow, this does not smell right and using version 7.2 of both the
ODBC-driver and postgres, I think something is wrong with it.
Hope you have any comments/suggestions?
Greetings,
Balt van Rees