Re: transaction and insert - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: transaction and insert
Date
Msg-id CAKFQuwYCuNp_CXg7cWpXoeKmfBv=UDn3pYQWqOefpNZCrqkwiw@mail.gmail.com
Whole thread Raw
In response to transaction and insert  (jack chen <jackchen88@gmail.com>)
Responses Re: transaction and insert  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
Adding back -bugs to the email chain........

On Wed, Jul 17, 2019 at 12:15 PM jack chen <jackchen88@gmail.com> wrote:
Thank you very much. The following is my code and output.



           try{
System.err.println(" I am here -------------------------------- 111111111111111 --------------------------------------- : ");
System.err.println(" 11111111111  : " + sqlUpdateAddSubTotal + sqlInsertAddRecord);
                                                rows = stmt.executeUpdate(sqlUpdateAddSubTotal + sqlInsertAddRecord);
System.err.println(" I am here -------------------------------- 2222222222222222 --------------------------------------- : ");
                }
                }
                catch(SQLException e)
                {
                        errMessage = e.getMessage();
System.err.println(" errMessage 99999999999999999999999999 : " + errMessage);
               }

output :

 I am here -------------------------------- 111111111111111 --------------------------------------- :
 11111111111  : update points set points = 4091028, balance = 4065108, record_time = '2019-7-18 5:3:2 +10:00', ip_address = '10.10.10.10' where user_id = 5105 and point_type = 2 and sequence = 2 and language = 'en' and locality = 'au';
insert into points values(5105, 2, 340, 'en', 'au', 26013, 25920, 4091028, 5186, 'Renew Own Domain With Web Only Hosting', '2019-7-18 5:3:2 +10:00', '110.110.110.110', null, null);
 I am here -------------------------------- 2222222222222222 --------------------------------------- :
 errMessage 99999999999999999999999999 : ERROR: invalid input syntax for integer: "Renew Own Domain With Web Only Hosting"
  Position: 75


Awesome, now we know that the 10th column of the points table is an integer but you are inserting some sort of textual name into it.

Its not clear that this ever actually worked but in any case you either need to rearrange the VALUES clause of the INSERT to match the column order of the points table or add the column names to the command.

INSERT INTO points (col1, col2, col3....) VALUES ('','',''....);

David J.

pgsql-bugs by date:

Previous
From: "Vianello, Daniel A"
Date:
Subject: RE: transaction and insert
Next
From: "David G. Johnston"
Date:
Subject: Re: transaction and insert