By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,304 Members | 1,253 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,304 IT Pros & Developers. It's quick & easy.

insert and heritage...

P: n/a
hi everyone.... i'm having a slight problem understanding something....
I've bought a book about programming postgres, and there's a part
concerning heritage.... so as i need to implement something like this in
my work, i'm testing it.

I have a database called project (no matter the name)... It contains
several tables. One of them is called "equipements" and has 5 columns :

CREATE TABLE equipements (id serial, adresseMac macaddr NOT NULL UNIQUE,
adresseIp cidr, etat char, administrable bool,primary key(id));

so i entered a first value in this table with :
INSERT INTO equipements (administrable,adresseip,adressemac,etat) VALUES
('false','192.168.0.1','FF:EE:DD:CC:BB:AA','0')\g

so far so good.

now, i have another table called "postetravail" that inherits from
"equipements".... it was created like this :

CREATE TABLE postetravail (nom char) INHERITS (equipements);

i want this table to have quite the same columns as "equipments", but
all i need for this entity is a name. When i look every column with sun
one studio (for example), i see them right...

my first trouble comes from the state of "id", that is no more a primary
key in "postetravail" while it was in "equipements", and it's located
between "etat" and "nom"
now i have

administrable
adresseip
adressemac
etat
id
nom

while i was awaiting :

id (primary key)
administrable
adresseip
adressemac
etat
nom

the next problem concerns the insert :

INSERT INTO postetravail (administrable,adresseip,adressemac,etat,nom)
VALUES ('false','192.168.0.2','FF:EE:DD:CC:BB:AB','1','bi g')\g
ERROR: value too long for type character(1)

What is the problem.... I have the values in the correct order (i
guess), and i keep having this error... i tried to add the id column in
the insert, but it did not solve the problem....

Does somebody have clues for these 2 problems ?
regards
Stephane
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 11 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.