Re: transaction and insert

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: jackchen88(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: transaction and insert
Date: 2019-07-17 19:24:43
Message-ID: CAKFQuwYCuNp_CXg7cWpXoeKmfBv=UDn3pYQWqOefpNZCrqkwiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Adding back -bugs to the email chain........

On Wed, Jul 17, 2019 at 12:15 PM jack chen <jackchen88(at)gmail(dot)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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2019-07-17 19:31:26 Re: transaction and insert
Previous Message Vianello, Daniel A 2019-07-17 18:58:18 RE: transaction and insert