dbTalk Databases Forums  

[BUGS] BUG #2779: Making an inherited table to a view causes could not open relation error in base table

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2779: Making an inherited table to a view causes could not open relation error in base table in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sven Klemm
 
Posts: n/a

Default [BUGS] BUG #2779: Making an inherited table to a view causes could not open relation error in base table - 11-24-2006 , 03:07 PM







The following bug has been logged online:

Bug reference: 2779
Logged by: Sven Klemm
Email address: sven (AT) c3d2 (DOT) de
PostgreSQL version: 8.1
Operating system: Linux (Debian)
Description: Making an inherited table to a view causes could not
open relation error in base table
Details:

Steps to reproduce:

CREATE TABLE base( name TEXT );
CREATE TABLE child() INHERITS( base );

CREATE RULE "_RETURN" AS ON SELECT TO child DO INSTEAD SELECT 'Chunky
Bacon'::text AS name;

SELECT * FROM child;
SELECT * FROM ONLY base;
-- the next query causes the error
SELECT * FROM base;

After dropping child queries to base work again.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2779: Making an inherited table to a view causes could not open relation error in base table - 11-24-2006 , 03:39 PM






"Sven Klemm" <sven (AT) c3d2 (DOT) de> writes:
Quote:
CREATE TABLE base( name TEXT );
CREATE TABLE child() INHERITS( base );

CREATE RULE "_RETURN" AS ON SELECT TO child DO INSTEAD SELECT 'Chunky
Bacon'::text AS name;
This is definitely in the category of "don't do that". It's an
oversight that DefineQueryRewrite() doesn't check for the case.

Actually, I wonder whether we still need to support conversion of
tables to views at all. That was never meant as anything but a
temporary hack to allow loading pre-7.1 pg_dump scripts.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


Reply With Quote
  #3  
Old   
Alvaro Herrera
 
Posts: n/a

Default Re: [BUGS] BUG #2779: Making an inherited table to a view causes could not open relation error in base table - 11-24-2006 , 03:47 PM



Tom Lane wrote:
Quote:
"Sven Klemm" <sven (AT) c3d2 (DOT) de> writes:
CREATE TABLE base( name TEXT );
CREATE TABLE child() INHERITS( base );

CREATE RULE "_RETURN" AS ON SELECT TO child DO INSTEAD SELECT 'Chunky
Bacon'::text AS name;

This is definitely in the category of "don't do that". It's an
oversight that DefineQueryRewrite() doesn't check for the case.

Actually, I wonder whether we still need to support conversion of
tables to views at all. That was never meant as anything but a
temporary hack to allow loading pre-7.1 pg_dump scripts.
IIRC I tried it when I was reviewing the updatable views patch, and it
worked.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


Reply With Quote
  #4  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2779: Making an inherited table to a view causes could not open relation error in base table - 11-24-2006 , 03:59 PM



Alvaro Herrera <alvherre (AT) commandprompt (DOT) com> writes:
Quote:
Tom Lane wrote:
Actually, I wonder whether we still need to support conversion of
tables to views at all. That was never meant as anything but a
temporary hack to allow loading pre-7.1 pg_dump scripts.

IIRC I tried it when I was reviewing the updatable views patch, and it
worked.
Well, yeah, it still works for the cases it was intended to work for.
What I'm wondering is what other weird corner cases might need to be
forbidden to keep it secure against people who are looking for ways
to break it.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.