summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2002-11-29 15:22:47 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2002-11-29 15:22:47 +0200
commit5b1220225abdc32d72690a1781d2ee5bb789355d (patch)
tree8c28fa812c9913c1cfeb3c2d0e52df0f97c0cfcc /sql
parentd46d26ec171e4574b58eba191264812c95eee976 (diff)
parent0a689e6cd0b2362b68fafd24763b07e7b525aec2 (diff)
downloadmariadb-git-5b1220225abdc32d72690a1781d2ee5bb789355d.tar.gz
many, many changes
mysql-test/r/subselect.result: Auto merged sql/sql_base.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged include/mysqld_error.h: Merging changes ... mysql-test/t/subselect.test: Merging changes ... sql/share/czech/errmsg.txt: Merging changes ... sql/share/danish/errmsg.txt: Merging changes ... sql/share/dutch/errmsg.txt: Merging changes ... sql/share/english/errmsg.txt: Merging changes ... sql/share/estonian/errmsg.txt: Merging changes ... sql/share/french/errmsg.txt: Merging changes ... sql/share/german/errmsg.txt: Merging changes ... sql/share/greek/errmsg.txt: Merging changes ... sql/share/hungarian/errmsg.txt: Merging changes ... sql/share/italian/errmsg.txt: Merging changes ... sql/share/japanese/errmsg.txt: Merging changes ... sql/share/korean/errmsg.txt: Merging changes ... sql/share/norwegian-ny/errmsg.txt: Merging changes ... sql/share/norwegian/errmsg.txt: Merging changes ... sql/share/polish/errmsg.txt: Merging changes ... sql/share/portuguese/errmsg.txt: Merging changes ... sql/share/romanian/errmsg.txt: Merging changes ... sql/share/russian/errmsg.txt: Merging changes ... sql/share/serbian/errmsg.txt: Merging changes ... sql/share/slovak/errmsg.txt: Merging changes ... sql/share/spanish/errmsg.txt: Merging changes ... sql/share/swedish/errmsg.txt: Merging changes ... sql/share/ukrainian/errmsg.txt: Merging changes ...
Diffstat (limited to 'sql')
-rw-r--r--sql/share/czech/errmsg.txt1
-rw-r--r--sql/share/danish/errmsg.txt1
-rw-r--r--sql/share/dutch/errmsg.txt1
-rw-r--r--sql/share/english/errmsg.txt1
-rw-r--r--sql/share/estonian/errmsg.txt1
-rw-r--r--sql/share/french/errmsg.txt1
-rw-r--r--sql/share/german/errmsg.txt1
-rw-r--r--sql/share/greek/errmsg.txt1
-rw-r--r--sql/share/hungarian/errmsg.txt1
-rw-r--r--sql/share/italian/errmsg.txt1
-rw-r--r--sql/share/japanese/errmsg.txt1
-rw-r--r--sql/share/korean/errmsg.txt1
-rw-r--r--sql/share/norwegian-ny/errmsg.txt1
-rw-r--r--sql/share/norwegian/errmsg.txt1
-rw-r--r--sql/share/polish/errmsg.txt1
-rw-r--r--sql/share/portuguese/errmsg.txt1
-rw-r--r--sql/share/romanian/errmsg.txt1
-rw-r--r--sql/share/russian/errmsg.txt1
-rw-r--r--sql/share/serbian/errmsg.txt1
-rw-r--r--sql/share/slovak/errmsg.txt1
-rw-r--r--sql/share/spanish/errmsg.txt1
-rw-r--r--sql/share/swedish/errmsg.txt1
-rw-r--r--sql/share/ukrainian/errmsg.txt1
-rw-r--r--sql/sql_base.cc4
-rw-r--r--sql/sql_derived.cc2
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_parse.cc7
27 files changed, 35 insertions, 3 deletions
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index 1a81a7e9182..31d47b821e0 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -256,4 +256,5 @@ v/*
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index e2d33a06fb3..ca5a6918517 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -250,4 +250,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index f4f2227f27f..6f5754dee76 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -258,4 +258,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 78c6e5185ec..66ca9eab596 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -247,4 +247,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 236c688a048..757ae5b6443 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -252,4 +252,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index fa732ed10e4..43952d848c4 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -247,4 +247,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index 62da0945799..f9a70feb549 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -250,4 +250,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index e4b594faad3..9410c3d69bb 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -247,4 +247,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index 161d686a0d7..1410a88af4a 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -249,4 +249,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 806cf1bbc2c..499c06e64dc 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -247,4 +247,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index 06ab3e3df25..90a6e23efbd 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -249,4 +249,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index 707b45f1cd4..f05ab3148eb 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -247,4 +247,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index 42d3245f3fb..5e75877145c 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -249,4 +249,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 7db402f193c..4330827fe1c 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -249,4 +249,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index c10c41c4c8b..db5b97554ff 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -251,4 +251,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 8c84b0f71cf..80c1b498345 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -247,4 +247,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 24d220f1f9d..59f6e550650 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -251,4 +251,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index ec682f7778e..fafcc61f60a 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -250,4 +250,5 @@
"Циклическая ссылка на подзапрос",
"Преобразование поля '%s' из %s в %s",
"Ссылка '%-.64s' не поддерживается (%s)",
+"Every derived table must have it's own alias"
"Select %u был упразднен в процессе оптимизации",
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index 4ccbc95eefc..6bcecf9e4c9 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -243,4 +243,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index e66ea93b021..55ead96545c 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -255,4 +255,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 8de5202952b..93a0abeed39 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -248,4 +248,5 @@
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index 31f4239e8e3..a996898446e 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -247,4 +247,5 @@
"Syklisk referens i subselect",
"Konvertar kolumn '%s' frЕn %s till %s",
"Reference '%-.64s' not supported (%s)",
+"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index 1caedcbb19c..0ec1d88e601 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -252,4 +252,5 @@
"Цикл╕чне посилання на п╕дзапит",
"Перетворення стовбца '%s' з %s у %s",
"Посилання '%-.64s' не пiдтримуется (%s)",
+"Every derived table must have it's own alias"
"Select %u was скасовано при оптимiзацii",
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index f8202035d51..fc50941c646 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1894,13 +1894,13 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
const char *name=item->field_name;
uint length=(uint) strlen(name);
- if (table_name)
+ if (table_name && table_name[0])
{ /* Qualified field */
bool found_table=0;
for (; tables ; tables=tables->next)
{
if (!strcmp(tables->alias,table_name) &&
- (!db || !strcmp(db,tables->db)))
+ (!db || !tables->db || !tables->db[0] || !strcmp(db,tables->db)))
{
found_table=1;
Field *find=find_field_in_table(thd,tables->table,name,length,
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index afdd1ccfdb2..2176740e67b 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -106,7 +106,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
t->table=table;
table->derived_select_number= sl->select_number;
table->tmp_table=TMP_TABLE;
- if (!lex->describe)
+ if (lex->describe)
sl->exclude();
t->db=(char *)"";
t->derived=(SELECT_LEX *)0; // just in case ...
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index be0430d4afe..724933e08d4 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1205,6 +1205,8 @@ bool st_select_lex_unit::create_total_list_n_last_return(THD *thd, st_lex *lex,
net_printf(thd,ER_WRONG_USAGE,"UNION","ORDER BY");
return 1;
}
+ if (sl->linkage == DERIVED_TABLE_TYPE)
+ continue;
for (SELECT_LEX_UNIT *inner= sl->first_inner_unit();
inner;
inner= inner->next_unit())
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2e8a431d212..114c9723510 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3404,8 +3404,15 @@ TABLE_LIST *st_select_lex::add_table_to_list(Table_ident *table,
}
if (!alias) /* Alias is case sensitive */
+ {
+ if (table->sel)
+ {
+ net_printf(thd,ER_DERIVED_MUST_HAVE_ALIAS);
+ DBUG_RETURN(0);
+ }
if (!(alias_str=thd->memdup(alias_str,table->table.length+1)))
DBUG_RETURN(0);
+ }
if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
DBUG_RETURN(0); /* purecov: inspected */