Conditional INSERT - Mailing list pgsql-general

From basti
Subject Conditional INSERT
Date
Msg-id 68951fae-3281-c9ad-09b7-205e0bb1c5ae@unix-solution.de
Whole thread Raw
Responses Re: Conditional INSERT  (Michel Pelletier <pelletier.michel@gmail.com>)
Re: Conditional INSERT  (Paul Jungwirth <pj@illuminatedcomputing.com>)
Re: Conditional INSERT  (Andreas Kretschmer <andreas@a-kretschmer.de>)
List 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.


pgsql-general by date:

Previous
From: Michel Pelletier
Date:
Subject: Re: jsonb_set performance degradation / multiple jsonb_set onmultiple documents
Next
From: Michel Pelletier
Date:
Subject: Re: Conditional INSERT