INSERT into PostGreSQL triggers "RevdbError" but no error

Sivakatirswami katir at hindu.org
Thu Sep 30 17:54:50 EDT 2010


  Slightly OT if this is more about PostGreSQL than LiveCodeServer

I'm doing my very first dbase insertion from an iRev form. finally getting
  a successful a connection ID after fiddling with pg_hba.conf

ASIDE: does RevServer connect on local unix domain socket or local tcp/ip

Then tried this (all copied from the rev lesson on line)

get 
revOpenDatabase("postgresql","localhost","useful_rodents","human","")  
#no password required.

put "INSERT INTO rats-w-wings (first_name, last_name, anonymous) \
        VALUES ('Batman', 'MosquitoEater', TRUE);" into tSQL

# we have to keep him anonymous because
# he's embarrassed that he eats mosquitos.
# sorry... I'm into kids' stories lately... I like to have fun the names of
# my test objects and vars... lightens up tedious debugging

   -- query the database

put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData

    -- check the result and display the data or an error message

     if item 1 of tData = "revdberr" then
         put "There was a problem querying the database:" & cr & tData 
into tResponse
     else
         put tData into tResponse
     end if

Now the odd part:  tData returns "revdberr,"  but no error verbiage

So I'm scratching my head... I open PhpPgAdmin and check...

Aha! Batman is there in Row 1! So, why the mysterious revdberr, from 
revServer?

So I log in via terminal sudo postgres and try the insertion "by hand"

useful_rodents=# INSERT INTO  rats-w-wings (first_name, last_name, 
anonymous)
    VALUES ('Batman', 'MosquitoEater', TRUE);

% INSERT 0 1

useful_rodents=#  I'm back at the prompt:

Again,quick check and the insertion of the data works... Null is allowed 
in all fields except anonymous,

I'm a complete SQL newbie: what do the params being returned after 
INSERT "0 1" mean?  the "useful_rodents" table has one row successfully 
added and the useful_rodents_rat-w-wings_seq integer which is linked the 
main table primary key: rat-w-wings_id is incremented by one integer... 
so two things are happening on insertion. and as far as I can tell, no 
errors are being generated... unless one of those two mysterious results 
params "INSERT 0 1" are telling us something I don't understand 
(searching the web for the meaning of those two results integers, but 
not getting anything)

so, why the revdberr,  ?

Any ideas?

Thanks!

Sivakatirswami










More information about the use-livecode mailing list