Re: Inserting Data

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Inserting Data
Дата
Msg-id 25846.1156376694@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Inserting Data  (Bob Pawley <rjpawley@shaw.ca>)
Список pgsql-general
Bob Pawley <rjpawley@shaw.ca> writes:
> What I have is one table which stores device_id numbers that are referenced
> on the second table "library.devices".
> I need to insert device_ids from the first table that satisfy the conditions
> of the argument found on the library table. Hence the 'where' clause.

This isn't real clear to me, but perhaps you are looking for something
like

    IF EXISTS(select 1 from library.devices where ...) THEN
        INSERT INTO ... values(new.device_id);
    END IF;

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: CASCADING could not open relation with OID
Следующее
От: Tim Allen
Дата:
Сообщение: Re: How do i store arbitrary questions and answers in SQL?