primary key view failure

From: rob caSSon <rob(at)styro(dot)lib(dot)muohio(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: primary key view failure
Date: 1999-08-05 13:52:23
Message-ID: Pine.LNX.3.96.990805095008.12775A-100000@styro.lib.muohio.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.attrelid AND
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.attrelid AND
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

Browse pgsql-sql by date

  From Date Subject
Next Message Patrick Giagnocavo 1999-08-05 14:18:55 Re: [SQL] qurey plan and indices
Previous Message Rob Casson 1999-08-05 12:47:00 weird view failure