[Pdns-users] Duplicate records in Postgresql records tables

Steven Truong midair77 at gmail.com
Mon Jun 4 21:36:39 UTC 2012


Dear all,

I am new to powerdns and just setup one with Postgresql backend.  The
problem is that I could insert duplicate records into records table.
Looking at the schema of records table, only the 'id' is the primary
key while 'name' is not being restricted in such a way to allow users
to only create unique records.

I am using the default schema that comes with Ubuntu 12.04.

Please share your thoughts and approaches to allow creating unique
records for domains.

Thank you very much,
Steven.

pdns=> select * from records;
 id | domain_id |           name           | type  |
           content                              | ttl | prio |
change_date | ordername | auth
----+-----------+--------------------------+-------+-------------------------------------------------------------------+-----+------+-------------+-----------+------
 25 |         5 | west.perto.net         | SOA   | ns.west.perto.net
sysadmin.perto.com 1 10800 900 604800 7200 |     |      |
|           |
 26 |         6 | east.perto.net         | SOA   | ns.east.perto.net
sysadmin.perto.com 1 10800 900 604800 7200 |     |      |
|           |
 27 |         5 | west.perto.net         | NS    | ns.west.perto.net
                                            |     |      |
|           |
 28 |         6 | east.perto.net         | NS    | ns.east.perto.net
                                            |     |      |
|           |
 29 |         5 | hadoop4.west.perto.net | A     | 192.168.122.103
                                              |     |      |
  |           |
 30 |         5 | ns.west.perto.net      | CNAME |
hadoop4.west.perto.net                                          |
|      |             |           |
 31 |         6 | hadoop4.east.perto.net | A     | 192.168.122.103
                                              |     |      |
  |           |
 32 |         6 | ns.east.perto.net      | CNAME |
hadoop4.east.perto.net                                          |
|      |             |           |
 33 |         5 | west.perto.net         | SOA   | ns.west.perto.net
sysadmin.perto.com 1 10800 900 604800 7200 |     |      |
|           |
 34 |         6 | east.perto.net         | SOA   | ns.east.perto.net
sysadmin.perto.com 1 10800 900 604800 7200 |     |      |
|           |
 35 |         5 | west.perto.net         | NS    | ns.west.perto.net
                                            |     |      |
|           |
 36 |         6 | east.perto.net         | NS    | ns.east.perto.net
                                            |     |      |
|           |
 37 |         5 | hadoop4.west.perto.net | A     | 192.168.122.103
                                              |     |      |
  |           |
 38 |         5 | ns.west.perto.net      | CNAME |
hadoop4.west.perto.net                                          |
|      |             |           |
 39 |         5 | puppet.west.perto.net  | CNAME |
hadoop4.west.perto.net                                          |
|      |             |           |
 40 |         6 | hadoop4.east.perto.net | A     | 192.168.122.103
                                              |     |      |
  |           |
 41 |         6 | ns.east.perto.net      | CNAME |
hadoop4.east.perto.net                                          |
|      |             |           |
(17 rows)

pdns=> \d+ records
                                                Table "public.records"
   Column    |          Type          |                      Modifiers
                      | Storage  | Description
-------------+------------------------+------------------------------------------------------+----------+-------------
 id          | integer                | not null default
nextval('records_id_seq'::regclass) | plain    |
 domain_id   | integer                |
                      | plain    |
 name        | character varying(255) | default NULL::character
varying                      | extended |
 type        | character varying(10)  | default NULL::character
varying                      | extended |
 content     | character varying(255) | default NULL::character
varying                      | extended |
 ttl         | integer                |
                      | plain    |
 prio        | integer                |
                      | plain    |
 change_date | integer                |
                      | plain    |
 ordername   | character varying(255) |
                      | extended |
 auth        | boolean                |
                      | plain    |
Indexes:
    "records_pkey" PRIMARY KEY, btree (id)
    "domain_id" btree (domain_id)
    "nametype_index" btree (name, type)
    "orderindex" btree (ordername)
    "rec_name_index" btree (name)
Foreign-key constraints:
    "domain_exists" FOREIGN KEY (domain_id) REFERENCES domains(id) ON
DELETE CASCADE
Has OIDs: no



More information about the Pdns-users mailing list