Re: Conditional INSERT

Поиск
Список
Период
Сортировка
От Michael Lewis
Тема Re: Conditional INSERT
Дата
Msg-id CAHOFxGr3WCD1Kb0mL8aXiRHyYpOaV98uzF_pcJA_ALF4V0qhjA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Conditional INSERT  (Michel Pelletier <pelletier.michel@gmail.com>)
Ответы Re: Conditional INSERT  (basti <mailinglist@unix-solution.de>)
Список pgsql-general
On Fri, Mar 15, 2019 at 10:55 AM basti <mailinglist@unix-solution.de> wrote:
Hello,

I want to insert data into table only if condition is true.
For example:

INSERT into  mytable (domainid, hostname, txtdata)
  VALUES (100,'_acme.challenge.example', 'somedata');
 
Alternative to a trigger implementation, if you are generating that INSERT statement, you can change it to use a sub-select or CTE that contains no values if the domainid isn't what you like. If you want it to fail with error, you could add a check constraint. We might need more context on what you are doing and why to give good advice.

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

Предыдущее
От: Michel Pelletier
Дата:
Сообщение: Re: Conditional INSERT
Следующее
От: Paul Jungwirth
Дата:
Сообщение: Re: Conditional INSERT