references fail over rows inserted via inherited tables

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: references fail over rows inserted via inherited tables
Date: 2001-05-20 23:38:31
Message-ID: 200105202338.f4KNcV716652@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Diego Saravia (dsa(at)unsa(dot)edu(dot)ar) reports a bug with a severity of 4
The lower the number the more severe it is.

Short Description
references fail over rows inserted via inherited tables

Long Description
When you insert a row via an inherited table, with 7.1.1, you can see in the parent table.

But when you try to insert a reference to that value you can't.

Sample Code
/*I have a problem with inherited primary keys

When I referenced a primary key inserted via an inherited table
it gives you an error

Is this the right way?

Example
*************************************************
*/

select version();
/* version
---------------------------------------------------------------
PostgreSQL 7.1.1 on i686-pc-linux-gnu, compiled by GCC 2.95.2
(1 row)
*/

create table persona(
id serial primary key,
nombre text
);

create table usuario(
alias text
) inherits (persona) ;

insert into usuario (alias,nombre) values ('no','NO');

insert into persona (nombre) values ('SI');

select * from persona;

/*
id | nombre
----+--------
2 | SI
1 | NO
(2 rows)
*/

select * from usuario;

/*
id | nombre | alias
----+--------+-------
1 | NO | no
(1 row)
*/

create table trabajo(
titulo text,
propietario integer references persona );

insert into trabajo (titulo,propietario) values ('capaz',1);

/*ERROR: <unnamed> referential integrity violation - key referenced from trabajo not found in persona */

insert into trabajo (titulo,propietario) values ('capaz',2);

select * from trabajo;

/*
titulo | propietario
--------+-------------
capaz | 2
(1 row)
*/

create table trabajo2(
titulo text,
propietario integer references usuario );

/*
ERROR: PRIMARY KEY for referenced table "usuario" not found

I think that this is also not Ok

*/

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2001-05-21 00:06:32 Re: references fail over rows inserted via inherited tables
Previous Message Ondrej Palkovsky 2001-05-19 11:11:47 Failing backend on plpgsql function