Page 1 of 1
Postgresql : problem with INSERT... RETURNING
Posted: Fri Aug 23, 2013 1:09 pm
by bangkok
I use a "INSERT INTO ... VALUES .... RETURNING ID" query , on a postgresql server, with LiveCode (version 5.5.3 and version 6.1) and the native postgresql driver for revOpenDatabase.
With revdb_execute or revExecuteSQL... LiveCode doesn't receive back the id... although the record is correctly created into the database.
I receive only a "0".
Do you have any idea ?
Re: Postgresql : problem with INSERT... RETURNING
Posted: Fri Aug 23, 2013 3:34 pm
by bangkok
I'm baffled !
The query is working fine with... revDataFromQuery !
Code: Select all
put revDataFromQuery(,,gID,dbSQL) into myResult
The ID created by Postgresql is correctly returned in myResult.
I always thought that revDataFromQuery was for SELECT queries !
Anyway... I found the hint on this thread :
http://runtime-revolution.278305.n4.nab ... 64759.html
Re: Postgresql : problem with INSERT... RETURNING
Posted: Sat Aug 24, 2013 1:15 pm
by BvG
Returning 0 on successful insert? Functional bug. Reports go here:
http://quality.runrev.com (example stacks or full solutions to see problem should ideally be attached)
revdatafromquery working with insert? interesting. In theory one could argue that this is a documentation bug, but in fact the dictionary does not really say that only select is allowed

(Could be clearer about that tho)
As a side note, I'd argue that revdb_execute is supposed to be deprecated, but that's probably just me being picky.