pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: rob caSSon <rob@styro.lib.muohio.edu>
To: pgsql-sql@postgresql.org
Subject: primary key view failure
Date: Thu, 5 Aug 1999 09:52:23 -0400 (EDT)
Message-ID: <Pine.LNX.3.96.990805095008.12775A-100000@styro.lib.muohio.edu> (raw)


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




view thread (8+ messages)  latest in thread

Message-ID: <Pine.LNX.3.96.990805095008.12775A-100000@styro.lib.muohio.edu>
Permalink:  ../Pine.LNX.3.96.990805095008.12775A-100000@styro.lib.muohio.edu/
Also on:    postgresql.org/message-id/Pine.LNX.3.96.990805095008.12775A-100000@styro.lib.muohio.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: rob@styro.lib.muohio.edu
  Subject: Re: primary key view failure
  In-Reply-To: <Pine.LNX.3.96.990805095008.12775A-100000@styro.lib.muohio.edu>
  References: <Pine.LNX.3.96.990805095008.12775A-100000@styro.lib.muohio.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox