Thread: create view problem
I'm using pg 7.4.5 (cygwin) on win xp sp1. When I enter:- create view v1 as select * from t1; I get:- ERROR: syntax error at or near "view" at character 16 Why? Chris -- Chris Velevitch Manager - Sydney Flash Platform Developers Group www.flashdev.org.au
"Chris Velevitch" <chris.velevitch@gmail.com> writes: > I'm using pg 7.4.5 (cygwin) on win xp sp1. > When I enter:- > create view v1 as select * from t1; > I get:- > ERROR: syntax error at or near "view" at character 16 Repeatably? "view" is not nearly 16 characters into that command. I think you typed something like junk here create view v1 ... regards, tom lane
On 6/2/06, Tom Lane wrote: > "Chris Velevitch" writes: > > I'm using pg 7.4.5 (cygwin) on win xp sp1. > > When I enter:- > > create view v1 as select * from t1; > > I get:- > > ERROR: syntax error at or near "view" at character 16 > > Repeatably? > > "view" is not nearly 16 characters into that command. I think you > typed something like > > junk here > create view v1 ... Yes, I had "explain" in front. Chris -- Chris Velevitch Manager - Sydney Flash Platform Developers Group www.flashdev.org.au
On 6/3/06, Chris Velevitch wrote: > On 6/2/06, Tom Lane wrote: > > "Chris Velevitch" writes: > > > I'm using pg 7.4.5 (cygwin) on win xp sp1. > > > When I enter:- > > > create view v1 as select * from t1; > > > I get:- > > > ERROR: syntax error at or near "view" at character 16 > > > > Repeatably? > > > > "view" is not nearly 16 characters into that command. I think you > > typed something like > > > > junk here > > create view v1 ... > > Yes, I had "explain" in front. Why doesn't explain work with create views? There's nothing in the documentation saying it shouldn't. If this is deliberate, the error should state that. Chris -- Chris Velevitch Manager - Sydney Flash Platform Developers Group www.flashdev.org.au
Chris Velevitch wrote: > Why doesn't explain work with create views? There's nothing in the > documentation saying it shouldn't. > No? The documentation for explain clearly states that the statement that follow the EXPLAIN keyword is "Any SELECT, INSERT, UPDATE, DELETE, EXECUTE, or DECLARE statement". I don't see CREATE (or any other ddl statement) in that list. Regards, Thomas Hallgren
On 6/5/06, Thomas Hallgren wrote: > Chris Velevitch wrote: > > Why doesn't explain work with create views? There's nothing in the > > documentation saying it shouldn't. > > > No? The documentation for explain clearly states that the statement that follow the EXPLAIN > keyword is "Any SELECT, INSERT, UPDATE, DELETE, EXECUTE, or DECLARE statement". I don't see > CREATE (or any other ddl statement) in that list. I stand corrected. But, wouldn't you want to see the execution plan for the select statement that appears in the create? And besides, a more meaning error message should be generated afterall it's not a syntax error, but a "that type of statement is not allowed in the EXPLAIN command" type of error. Chris -- Chris Velevitch Manager - Sydney Flash Platform Developers Group www.flashdev.org.au
"Chris Velevitch" <chris.velevitch@gmail.com> writes: > But, wouldn't you want to see the execution plan for the select > statement that appears in the create? Then give the EXPLAIN the select statement that appears in the create. Logically, EXPLAIN of a DDL statement would tell you about the costs of performing the catalog modifications involved in the DDL statement. Which wouldn't have anything to do with what you request above. I don't believe that CREATE VIEW ever bothers to form a plan for the view query at all --- it just stuffs the parse tree into the catalogs. regards, tom lane