[Pdns-users] Documentation on populating backend database tables

Sebastian Tennant sebyte at smolny.plus.com
Sun Apr 24 07:32:40 UTC 2011

Quoth Kenneth Marshall <ktm at rice.edu>:
> Here is a basic desciption of the fields and queries that PDNS uses:
> http://doc.powerdns.com/generic-mypgsql-backends.html#id587910

Thanks.  I see now.  The first half of the 'Basic functionality' section
describes the records table.  It might help if the words 'records table' were
mentioned there somewhere. The emphasis is very much on making queries rather
than populating your database with answers.

Here are my notes:

 -- file:///usr/share/doc/pdns-doc/html/generic-mypgsql-backends.html

 CREATE TABLE records (
   id              INTEGER      PRIMARY KEY,  -- undocumented
   domain_id       INTEGER      DEFAULT NULL, -- references domains.id?
   name            VARCHAR(255) DEFAULT NULL, -- FQDN
   type            VARCHAR(6)   DEFAULT NULL, -- (type=qtype?) A,MX,SOA,AAAA
   content         VARCHAR(255) DEFAULT NULL, -- A=IP, NS=..
   ttl             INTEGER      DEFAULT NULL, -- time to live
   prio            INTEGER      DEFAULT NULL, -- MX priority
   change_date     INTEGER      DEFAULT NULL ); -- undocumented

There are a couple of questions in there:

 1. Does records.domain_id need to reference domains.id?  The manual says that
    each domain *must* have a unique domain_id, yet the default value is NULL?

 2. Does 'type' (used in the records table schema) mean 'qtype' (used in the

My attempt to answer them:

 1. Doesn't matter in a simple use case like mine.  Forget about the other
    tables (domains & supermasters) and the domain_id column and just increment
    the id column manually on each insert.

 2. It probably does, which means it's a bug, either in my schema file, or in
    the manual.

> Consult your favorite DNS RFC/documentation to see what records you need to
> set up a zone.

Can you recommend one?

Better still, as mine is such a simple use case, can you not just tell me
whether or not these four INSERTS will do the job the comments optimistically
claim they do:

--8<---------------cut here---------------start------------->8---
 -- create nameservers
 INSERT INTO records (id, name, type, content, ttl) VALUES
  (1, 'foo.net', 'NS', 'ns1.foo.net', 25920);
 INSERT INTO records (id, name, type, content, ttl) VALUES
  (2, 'foo.net', 'NS', 'ns2.foo.net', 25920);

 -- publish ip addresses of nameservers
 INSERT INTO records (id, name, type, content, ttl) VALUES
  (3, 'ns1.foo.net', 'A', '', 8640);
 INSERT INTO records (id, name, type, content, ttl) VALUES
  (4, 'ns2.foo.net', 'A', '', 8640);
--8<---------------cut here---------------end--------------->8---

Do I need to do any more thatn this?


Eamcs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.

More information about the Pdns-users mailing list