The pgsqldns SQL Schema
pgsqldns makes use of two tables, domain and
entry.
domain must contain at least the following fields:
- id INT NOT NULL PRIMARY KEY
- name TEXT NOT NULL
entry must contain at least the following fields:
- prefix TEXT NOT NULL
- domain INT NOT NULL REFERENCES domain(id)
- type INT NOT NULL
- ttl INT NOT NULL
- timestamp TIMESTAMP
- ip INET
- master_ip BOOL
- distance INT
- name TEXT
If timestamp is set and ttl is zero, the TTL
sent in the record is set such that the record will expire no later
than the given time, and after the given time is reached the record is
no longer served out. If timestamp is set and ttl
is not zero, the record is only served out after the given time (with
its TTL as indicated).
type must be one of the following:
- 1 == A (address). The ip and master_ip fields
are used.
- 15 == MX (mail exchanger). The distance and name
fields are used.
- 16 == TXT (Text). The name field is used as the text
string.
All other types are currently ignored.
These tables may contain any additional fields. It is recommended
to index on domain(name), entry(prefix,domain), and
on entry(ip) for maximum performance, as these are the fields
used as select keys.
The pgsqldnscache SQL Schema
This program needs one table dnscache. It has the
following fields:
- domain text not null
- type int2 not null
- expire timestamp
- ip inet
- distance int2
- name text
This table must be created WITH OIDS, because OIDS are used by cleanup
function cleandnscache(bool). If you call this function with true
argument, all expired records are removed from cache. When called
with false, only duplicate records are removed (The same record can be
inserted into database more times).