Re: feature proposal ...

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Stark <gsstark@mit.edu>
Cc: Andrew Dunstan <andrew@dunslane.net>, Rod Taylor <pg@rbt.ca>, tshipley@deru.com, pgsql-hackers@postgresql.org
Date: 2005-09-22T14:40:20Z
Lists: pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> So we could refute this argument by just not making the permission check for
>> CREATE TEMP VIEW.

> This is the first time I've ever heard of CREATE TEMP VIEW. What's the point
> of it since you can always directly do:
>   SELECT * FROM (...)
> ?

Separation of concerns, for one thing: the code using the view need not
know the exact contents of the select, or perhaps not even have
permissions to access the underlying tables.  (Think of a temp view
created by a SECURITY DEFINER function for instance.)  In this
particular case it gives us separation of concerns in a different way,
ie, we don't have to figure out a way to force-fit the complete syntax
of SELECT inside a COPY command.

			regards, tom lane