Conditional INSERT

From: basti <mailinglist(at)unix-solution(dot)de>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Conditional INSERT
Date: 2019-03-15 17:55:34
Message-ID: 68951fae-3281-c9ad-09b7-205e0bb1c5ae@unix-solution.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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');

The insert should only be done if Hostname like %_acme.challenge%.

How can it be done? I dont want that the user/script can insert any value.

Best regards.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michel Pelletier 2019-03-15 18:10:04 Re: Conditional INSERT
Previous Message Michel Pelletier 2019-03-15 16:35:13 Re: jsonb_set performance degradation / multiple jsonb_set on multiple documents