Re: Help

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: Help
Дата
Msg-id 56EB3D34.3040003@hogranch.com
обсуждение исходный текст
Ответ на Help  (Ritanjali M <ritanjalim60@gmail.com>)
Ответы Re: Help  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
On 3/17/2016 6:48 AM, Ritanjali M wrote:
>
> I am new to PostgreSQL ,i want to insert record into multiple table in
> a single transaction and i need to get identity value from first table
> and need to insert into  second table with same transaction,so please
> help me out with example.
>


this is not a bug, and shouldn't be sent to the pgsql_bugs reporting
mail list.

you probably want to subscribe to and post to the pgsql-general email
list for these sorts of questions....

but, you would do something like..

     begin;
     insert into firsttable .....  returning id;
     insert into secondtable ....  values (....including 'id' value
returned by previous query...);
     commit;

its up to your application program making these calls to accept the
return value of the first insert and include it in the 2nd insert, the
specifics of doing that are programming language and sql binding specific.



--
john r pierce, recycling bits in santa cruz

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #14026: Problem to convert number to real
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #14025: Unable to validate constraints