[Pdns-users] Domain serial with Postgres backend
James Cloos
cloos at jhcloos.com
Sun Aug 31 01:02:37 UTC 2008
>>>>> "Mitchell" == Mitchell Smith <mjsotn at gmail.com> writes:
Mitchell> In my SOA records I am specifying the serial as 0, which according to the
Mitchell> documentation will cause PowerDNS to generate a serial for the domain based
Mitchell> on the changed_date of the records.
That doesn't work with the generic sql backend.
You have to do it in the sql.
I'd use a view rather than a table for records. Have it grab the values
from one or more backend tables for everything other than SOA RRs, and
create SOA RR rows from the data in the domains table (which should be
extended to include everything in an SOA other than serial) and the
largest changed_date column from that domain's RRs.
Something akin to:
SELECT rr.content, rr.ttl, rr.prio, rr."type", rr.domain_id, rr.name
FROM rr
WHERE rr."type"::text <> 'SOA'::text
UNION
SELECT domains.soa_host || ' '::text || domains.soa_email || ' '::text ||
domains.serial AS content, domains.default_ttl AS ttl,
NULL AS prio, 'SOA' AS "type", domains.id AS domain_id, domains.name
FROM domains;
(which I grabbed from some old notes; obviously domains.serial needs to
be replaced with GREATEST and a join).
-JimC
--
James Cloos <cloos at jhcloos.com> OpenPGP: 1024D/ED7DAEA6
More information about the Pdns-users
mailing list