Re: inserting references

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: inserting references
Дата
Msg-id 20020614182519.A19721@svana.org
обсуждение исходный текст
Ответ на inserting references  (ktt <kestutis98@yahoo.com>)
Ответы Re: inserting references  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Fri, Jun 14, 2002 at 01:14:08AM -0700, ktt wrote:
> I have a table, which references
> values in other 3 tables.
>
> I would like to insert values in
> bananas, oranges and kivi tables
> and insert their bananas_id,oranges_id,kivi_id,
> country
> in fruits table.
>
> What are better methods for doing
> this(exept LAST_INSERT_ID())?
> Would be nice to use the most compact form.

If you're using sequences, just use currval() in the insert statement for
fruits.

> sample tables scheme
>
> -----------   ----------   ----------   ----------
>
> fruits        bananas      oranges      kivi
>
> -----------   ----------   ----------   ----------
>
> fruits_id     bananas_id   oranges_id   kivi_id
>
> bananas_id    date_bn      date_or      date_kv
>
> oranges_id    ----------   ----------   ----------
>
> kivi_id
> country
>
> -----------
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

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

Предыдущее
От: ktt
Дата:
Сообщение: inserting references
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: jobs.postgresql.org - Who's interested?