Re: Was: Triggers, Stored Procedures, PHP - Mailing list pgsql-general

From Shane D
Subject Re: Was: Triggers, Stored Procedures, PHP
Date
Msg-id 3FC95A88.3020708@wright.edu
Whole thread Raw
In response to Re: Was: Triggers, Stored Procedures, PHP  (Doug McNaught <doug@mcnaught.org>)
Responses Re: Was: Triggers, Stored Procedures, PHP
List pgsql-general
Doug McNaught wrote:

> It's false.  You can treat a view just like a table and add clauses to
> your query that restrict it beyond what the view gives you.  I think
> that's what you're asking about...

   Thanks for your reply.

   I found an example in the postgresql reference manual in the "CREATE
VIEW" section that shows exactly what you said (reproduced below).

CREATE VIEW kinds AS
SELECT *
FROM films
WHERE kind = ’Comedy’;

   The manual uses the view thusly:

SELECT * FROM kinds;

   But what if the films table also had a field for the production
company.  This implies based on the view definition that it too, has the
field (call it prod_co).  Could I use the following query to select all
Comedy films distributed by the 'Small Company' production company?

SELECT * FROM kinds WHERE prod_co = 'Small Company';

   Yes this is contribed, but humor me please.

   Shane


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Drop Cascade of Domains
Next
From: Doug McNaught
Date:
Subject: Re: Was: Triggers, Stored Procedures, PHP