create view problem

Started by Chris Velevitchalmost 20 years ago7 messagesgeneral
Jump to latest
#1Chris Velevitch
chris.velevitch@gmail.com

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Chris Velevitch (#1)
Re: create view problem

"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

#3Chris Velevitch
chris.velevitch@gmail.com
In reply to: Tom Lane (#2)
Re: create view problem

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

#4Chris Velevitch
chris.velevitch@gmail.com
In reply to: Chris Velevitch (#3)
Re: create view problem

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

#5Thomas Hallgren
thhal@mailblocks.com
In reply to: Chris Velevitch (#4)
Re: create view problem

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

#6Chris Velevitch
chris.velevitch@gmail.com
In reply to: Thomas Hallgren (#5)
Re: create view problem

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

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Chris Velevitch (#6)
Re: create view problem

"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