Re: RETURNING id problem with insert.

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: RETURNING id problem with insert.
Дата
Msg-id AANLkTimx874MjzqQD5aXnUTTYSZvNsN_K-ODL7erHdQE@mail.gmail.com
обсуждение исходный текст
Ответ на Re: RETURNING id problem with insert.  (- <grandebuzon@gmail.com>)
Ответы Re: RETURNING id problem with insert.  (- <grandebuzon@gmail.com>)
Список pgsql-jdbc
On Tue, Dec 7, 2010 at 5:05 PM, - <grandebuzon@gmail.com> wrote:
> With this code, always returns 1 instead of new generated ID
>  <insert id="insertNewItem" parameterType="itemAlias"
> useGeneratedKeys="true" keyProperty="item_id">
> INSERT INTO items (
> category_id,
> description,
> ...)
> VALUES(
> #{category_id},
> #{description},
> ...)
>   </insert>
> and if I put RETURNING item_id at the end of insert,
> ......
> VALUES(
> #{category_id},
> #{description},
> ...) RETURNING item_id
>
>   </insert>
>
>  fails with error in the postgres log - syntax error at or near "RETURNING"
> ........$12,
> $13,
> $14)
> RETURNING item_id RETURNING *

It appears that Ibatis added RETURNING * after your RETURNING item_id.
I'd speak to them to see how to do it properly.

Dave

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: -
Дата:
Сообщение: Re: RETURNING id problem with insert.
Следующее
От: -
Дата:
Сообщение: Re: RETURNING id problem with insert.