Re: Conditional INSERT: if not exists

Поиск
Список
Период
Сортировка
От Franck Routier
Тема Re: Conditional INSERT: if not exists
Дата
Msg-id 44ECA533.9000602@axege.com
обсуждение исходный текст
Ответ на Conditional INSERT: if not exists  ("Don Morrison" <donmorrison@gmail.com>)
Ответы Re: Conditional INSERT: if not exists  ("Don Morrison" <donmorrison@gmail.com>)
Список pgsql-novice
Hi,

why not simply put a where condition in you insert :

insert into table values (a,b)
where not exists (select a,b from table)



Don Morrison a écrit :
> I want to insert a row unless it exists already.  Do I have to write a
> stored procedure to do this?
>
> Thanks,
> Don
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org
>


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

Предыдущее
От: Keith Worthington
Дата:
Сообщение: protecting a database
Следующее
От: "Andrej Ricnik-Bay"
Дата:
Сообщение: Re: protecting a database