You are not logged in.

#1 2009-04-15 06:14:33

darthaxul
Member
Registered: 2008-09-24
Posts: 156

postgres vs dns

I need to setup a dns server so I grabbed powerdns and postgres from the repos.
I found this guide
http://www.idimmu.net/2008/10/10/Using- … untu-Gutsy
but when I got to the part of insterting my specific hostnames it doesnt allow it for some reason.

insert into records (domain_id,name,content,type,ttl,prio) values(1,'myservertest','myserver','NS',86400,NULL)

It errors and says: insert or update on table 'records' violates foriegn key constraint "domain_exists" key domain_id is not present in table "domains"

--EDIT---
bah, I also tried something called poweradmin to setup the database but stuck on step 4 "updating database..." and gave up after 30 mins.

Last edited by darthaxul (2009-04-15 07:25:53)

Offline

#2 2009-04-15 07:38:09

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: postgres vs dns

ahh. referential integrity. smells so clean.

so yeah. you just have to have something in the domains table for your domain, before you can add records for that domain. looks like that website you linked left out that step.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2009-04-15 08:33:28

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,222
Website

Re: postgres vs dns

What cactus said... Instead of storing 'foo.com' in the 'records' table, the database stores it in the 'domains' table with a Primary Key (eg, '1'), and then references the key '1' in the 'domains' table from the 'records table.

Data integrity -> If 'foo.com' was stored in the 'records' table for each record, then it would be easy to accidentally create a record for 'fooo.com' and spend hours trying to figure it out.
Sanitising Data -> (Not Satanising) Why store 'foo.com' 100 times for 100 records? When you can store '1' instead? wink Doesn't really make a difference in a database this small but in very large databases, it can save space.

Offline

Board footer

Powered by FluxBB