From: basti <mailinglist@unix-solution.de>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Conditional INSERT
Date: Fri, 15 Mar 2019 18:55:34 +0100
Message-ID: <68951fae-3281-c9ad-09b7-205e0bb1c5ae@unix-solution.de> (raw)
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: mailinglist@unix-solution.de
Subject: Re: Conditional INSERT
In-Reply-To: <68951fae-3281-c9ad-09b7-205e0bb1c5ae@unix-solution.de>
References: <68951fae-3281-c9ad-09b7-205e0bb1c5ae@unix-solution.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox