Postgresql : problem with INSERT... RETURNING

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Postgresql : problem with INSERT... RETURNING

Post by bangkok » Fri Aug 23, 2013 1:09 pm

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 ?

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Postgresql : problem with INSERT... RETURNING

Post by bangkok » Fri Aug 23, 2013 3:34 pm

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

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Postgresql : problem with INSERT... RETURNING

Post by BvG » Sat Aug 24, 2013 1:15 pm

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.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply