From: | Cuevas Luis <lcuevas_br(at)yahoo(dot)com> |
---|---|
To: | pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx |
Subject: | [Pgsql-ayuda] Herencia entre tablas. |
Date: | 2004-01-23 13:31:21 |
Message-ID: | 20040123133121.23065.qmail@web13208.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Amigos/as miren este ejemplo de herencia entre tablas.
Fuera fantastico que funcionara, no creen?
* CREATE TABLE tabla1 (
id int2 NOT NULL,
Nombre varchar(10),
CONSTRAINT tabla1_pkey PRIMARY KEY (id)
) WITH OIDS;
INSERT INTO tabla1 VALUES (1, l);
* CREATE TABLE tabla2 (
Salario float4
) INHERITS(tabla1) WITH OIDS;
INSERT INTO tabla2 VALUES (2, a, 34);
* CREATE TABLE tabla3 (
Titulo varchar(10)
) INHERITS(tabla1) WITH OIDS;
INSERT INTO tabla3 VALUES (3, s, T);
* CREATE TABLE General (
Tipo int2,
Comentario varchar(10),
CONSTRAINT mref1 FOREIGN KEY (Tipo) REFERENCES
tabla1 (id)) WITH OIDS;
INSERT INTO General VALUES (3, per);
ERROR: mref1 referential integrity violation - key
referenced from general not found in tabla1
INSERT INTO General VALUES (2, per);
ERROR: mref1 referential integrity violation - key
referenced from general not found in tabla1
INSERT INTO General VALUES (1, per);
OK
Comentarios...
Saludos
Luis
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2004-01-23 14:24:12 | Re: [Pgsql-ayuda] Herencia entre tablas. |
Previous Message | nuria montoya rodriguez | 2004-01-23 09:33:53 | Re: [Pgsql-ayuda] (no subject) |