Am 15.03.19 um 18:55 schrieb basti:
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%.
you can use a check-constraint:
create table mytable(hostname text, check(hostname like
'%_acme.challenge%'));
I think you can see the idea...
Regards, Andreas
--
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com