Hi, Batching once again brings up a new topic. And not all Jdbc drivers do handle that as expected or in an expected way and also sometimes incorrect. So first of all I would test again if batch insert and returning works with your Jdbc driver as you want it to. Secondly if you batch you collect a set of insert statement to fire them in bulk to the database. Which returning would be the correct one? Result of first insert result of last Result set of all or some projection? I have to admit I never used this setup with batching before.
Greetings Gerald Von meinem iPhone gesendet > Am 14.07.2021 um 12:20 schrieb Zuzana Krenkova <zuzana.krenk...@yoso.fi>: > > I am still struggling to make it work. The returning clause works fine if > used with a single insert but I need to use a batch insert and then it just > inserts values and does not return anything. Is there a way how to get around > this? > > the values are taken from the body: [{new_token=5}, {new_token=8}] > > route: > from(direct:input) > .bean(tokenService, "prepareIDExtraction") > .to(ENDPOINT_EXTRACT_ID+ "?batch=true") > .to(direct:output); > sql: > INSERT INTO dim_token(token) values(:#new_token) > ON CONFLICT (token) > DO UPDATE SET token=excluded.token returning id, token > > > > > > >> On 2021/07/12 13:31:26, Gerald Mixa <gerald.m...@gmail.com> wrote: >> Hello, >> Are you sure that your Jdbc driver does really return a result after >> executing this DML statement? >> Some Jdbc drivers do not return this correctly. Maybe do a little manual >> test with your Jdbc drivers do not handle this in a correct way! >> >> Greetings >> >> Gerald >> Von meinem iPhone gesendet >> >>>> Am 12.07.2021 um 14:33 schrieb Zuzana Krenkova <zuzana.krenk...@yoso.fi>: >>> >>> Is it possible to use PostgreSQL insert with returning clause with Camel >>> sql component? This insert statement works fine on its own (inserting and >>> also returning id and token), but when used in a Camel route, the insert >>> gets processed but exchange body is returned empty. Why? >>> >>> INSERT INTO my_table(token) values(:#new_token) >>> ON CONFLICT (token) >>> DO UPDATE SET token=excluded.token returning id, token >>