Bug #23873 SELECT statement works, but not done as CREATE VIEW AS
| Submitted: | 2 Nov 2006 4:46 | Modified: | 2 Nov 2006 6:51 |
|---|---|---|---|
| Reporter: | Samuel Wright | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.27 | OS: | Windows (Win2003) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | create, duplicate, VIEW | ||
[2 Nov 2006 4:46]
Samuel Wright
[2 Nov 2006 4:48]
Samuel Wright
SQL script to re-create my database and attempt the view
Attachment: MySQL_Bug_Report.txt (text/plain), 7.82 KiB.
[2 Nov 2006 4:54]
Paul DuBois
It's easy to write a SELECT statement that produces a result set with duplicate column names: mysql> drop table if exists t; Query OK, 0 rows affected (0.07 sec) mysql> create table t (i int); Query OK, 0 rows affected (0.02 sec) mysql> insert into t (i) values(0); Query OK, 1 row affected (0.01 sec) mysql> select * from t join t as t2; +------+------+ | i | i | +------+------+ | 0 | 0 | +------+------+ 1 row in set (0.01 sec) But that SELECT won't work as a view because view column names must be unique: mysql> create view v as select * from t join t as t2; ERROR 1060 (42S21): Duplicate column name 'i' It's necessary to provide unique column names: mysql> create view v as select t.i, t2.i as i2 from t join t as t2; Query OK, 0 rows affected (0.32 sec) In your case, it might be inconvenient to create unique column names, but the requirement exists nonetheless.
[2 Nov 2006 6:51]
MySQL Verification Team
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.