primary key view failure - Mailing list pgsql-sql

From rob caSSon
Subject primary key view failure
Date
Msg-id Pine.LNX.3.96.990805095008.12775A-100000@styro.lib.muohio.edu
Whole thread Raw
Responses Re: [SQL] primary key view failure
List pgsql-sql
i have a perfectly valid sql statement that returns expected results, but
when i create a view based on the same sql, i get 0. similar views all
work correctly:

an example (to return primary keys):

SELECT  pg_class.relname, pg_attribute.attname       FROM pg_class, pg_attribute, pg_index       WHERE pg_class.oid =
pg_attribute.attrelidAND       pg_class.oid = pg_index.indrelid AND       pg_index.indkey[0] = pg_attribute.attnum AND
    pg_index.indisprimary = 't';
 

relname        |attname
---------------+-------
active_sessions|sid
auth_user      |uid
arraytest      |control
(3 rows)

but w/ this:

CREATE VIEW blah AS
SELECT  pg_class.relname, pg_attribute.attname       FROM pg_class, pg_attribute, pg_index       WHERE pg_class.oid =
pg_attribute.attrelidAND       pg_class.oid = pg_index.indrelid AND       pg_index.indkey[0] = pg_attribute.attnum AND
    pg_index.indisprimary = 't';
 

SELECT * FROM blah;

relname|attname
-------+-------
(0 rows)


any pointers....i've seen similar references to this in the list
archives, but no leads....never really thought of creating all of this
stuff as views....still pretty green, i guess.

tia,
rob



pgsql-sql by date:

Previous
From: MESZAROS Attila
Date:
Subject: qurey plan and indices
Next
From: Patrick Giagnocavo
Date:
Subject: Re: [SQL] qurey plan and indices