[Pdns-users] Adding multiple records to all zones at once

Klaus Darilion klaus.darilion at nic.at
Fri Oct 13 07:16:31 UTC 2023


> Why not do something along the lines of (PostgreSQL syntax as that's
> what I know, and completely untested):
> 
> INSERT INTO records (domain_id, name, type, content, ttl)
>    SELECT domain.id, 'autoconfig.' || domains.name, 'CNAME, '<my autoconfig
> zone>, 3600
>        FROM domains
>        JOIN records ON domains.id = records.domain_id
>        WHERE domains.id NOT IN (
>            SELECT domains_id FROM records
>                JOIN domains ON domains.id = records.domain_id
>                WHERE name = 'autoconfig.' || domains.name );
> 
> You may want to just run the SELECT first to see that it gives you what
> you want.

When you insert records directly into the DB, the zone may be broken (NSEC, NSEC3 ordername, empty non-terminal RRs ...).

Therefore you have to call "rectify" for every zone that was changed and PowerDNS will check and if necessary fix the zone.

regards
Klaus


More information about the Pdns-users mailing list