Thread: weird view failure

weird view failure

From
Rob Casson
Date:
new to list....

i have a perfectly valid sql statement that returns expected results, but
when i create a view based on the same sql, i get nada. 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 reference 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