Commit 7ce515d4 authored by mskold@mysql.com's avatar mskold@mysql.com

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0
parents 46ee6c87 aeb5ab5d
...@@ -1116,3 +1116,4 @@ vio/test-ssl ...@@ -1116,3 +1116,4 @@ vio/test-ssl
vio/test-sslclient vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
ndb/src/dummy.cpp
...@@ -58,6 +58,8 @@ INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05 ...@@ -58,6 +58,8 @@ INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05
SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA','V','VA',''), 'Privat (Private Nutzung)','Privat (Private Nutzung) Sitz im Ausland','Privat (geschaeftliche Nutzung)','Privat (geschaeftliche Nutzung) Sitz im Ausland','Firma (Kapitalgesellschaft)','Firma (Kapitalgesellschaft) Sitz im Ausland','Firma (Personengesellschaft)','Firma (Personengesellschaft) Sitz im Ausland','oeff. rechtl. Koerperschaft','oeff. rechtl. Koerperschaft Sitz im Ausland','Eingetragener Verein','Eingetragener Verein Sitz im Ausland','Typ unbekannt') AS Kundentyp ,kategorie FROM t1 WHERE hdl_nr < 2000000 AND kategorie IN ('Prepaid','Mobilfunk') AND st_klasse = 'Workflow' GROUP BY kundentyp ORDER BY kategorie; SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA','V','VA',''), 'Privat (Private Nutzung)','Privat (Private Nutzung) Sitz im Ausland','Privat (geschaeftliche Nutzung)','Privat (geschaeftliche Nutzung) Sitz im Ausland','Firma (Kapitalgesellschaft)','Firma (Kapitalgesellschaft) Sitz im Ausland','Firma (Personengesellschaft)','Firma (Personengesellschaft) Sitz im Ausland','oeff. rechtl. Koerperschaft','oeff. rechtl. Koerperschaft Sitz im Ausland','Eingetragener Verein','Eingetragener Verein Sitz im Ausland','Typ unbekannt') AS Kundentyp ,kategorie FROM t1 WHERE hdl_nr < 2000000 AND kategorie IN ('Prepaid','Mobilfunk') AND st_klasse = 'Workflow' GROUP BY kundentyp ORDER BY kategorie;
Kundentyp kategorie Kundentyp kategorie
Privat (Private Nutzung) Mobilfunk Privat (Private Nutzung) Mobilfunk
Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
AUFNR varchar(12) NOT NULL default '', AUFNR varchar(12) NOT NULL default '',
......
...@@ -722,3 +722,27 @@ WHERE hostname LIKE '%aol%' ...@@ -722,3 +722,27 @@ WHERE hostname LIKE '%aol%'
GROUP BY hostname; GROUP BY hostname;
hostname no hostname no
cache-dtc-af05.proxy.aol.com 1 cache-dtc-af05.proxy.aol.com 1
drop table if exists t1, t2;
Warnings:
Note 1051 Unknown table 't2'
create table t1 (c1 char(3), c2 char(3));
create table t2 (c3 char(3), c4 char(3));
insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
insert into t2 values ('aaa', 'bb1'), ('aaa', 'bb2');
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by c2;
c2
aaa
aaa
Warnings:
Warning 1052 Column 'c2' in group statement is ambiguous
show warnings;
Level Code Message
Warning 1052 Column 'c2' in group statement is ambiguous
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by t1.c1;
c2
aaa
show warnings;
Level Code Message
drop table t1, t2;
...@@ -304,6 +304,7 @@ s1 ...@@ -304,6 +304,7 @@ s1
0 0
0 0
Warnings: Warnings:
Warning 1052 Column 's1' in group statement is ambiguous
Warning 1052 Column 's1' in having clause is ambiguous Warning 1052 Column 's1' in having clause is ambiguous
select s1*0 from t1 group by s1 having s1 = 0; select s1*0 from t1 group by s1 having s1 = 0;
s1*0 s1*0
......
...@@ -975,3 +975,11 @@ EMPNUM NAME GRP ...@@ -975,3 +975,11 @@ EMPNUM NAME GRP
0 KERI 10 0 KERI 10
9 BARRY NULL 9 BARRY NULL
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE TABLE t1 (c11 int);
CREATE TABLE t2 (c21 int);
INSERT INTO t1 VALUES (30), (40), (50);
INSERT INTO t2 VALUES (300), (400), (500);
SELECT * FROM t1 LEFT JOIN t2 ON (c11=c21 AND c21=30) WHERE c11=40;
c11 c21
40 NULL
DROP TABLE t1, t2;
...@@ -539,3 +539,26 @@ SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1 ...@@ -539,3 +539,26 @@ SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1
WHERE hostname LIKE '%aol%' WHERE hostname LIKE '%aol%'
GROUP BY hostname; GROUP BY hostname;
#
# Bug#11211: Ambiguous column reference in GROUP BY.
#
drop table if exists t1, t2;
create table t1 (c1 char(3), c2 char(3));
create table t2 (c3 char(3), c4 char(3));
insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
insert into t2 values ('aaa', 'bb1'), ('aaa', 'bb2');
# query with ambiguous column reference 'c2'
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by c2;
show warnings;
# this query has no ambiguity
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by t1.c1;
show warnings;
drop table t1, t2;
...@@ -698,4 +698,16 @@ SELECT * FROM v1 WHERE EMPNUM < 10; ...@@ -698,4 +698,16 @@ SELECT * FROM v1 WHERE EMPNUM < 10;
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# Test for bug #11285: false Item_equal on expression in outer join
#
CREATE TABLE t1 (c11 int);
CREATE TABLE t2 (c21 int);
INSERT INTO t1 VALUES (30), (40), (50);
INSERT INTO t2 VALUES (300), (400), (500);
SELECT * FROM t1 LEFT JOIN t2 ON (c11=c21 AND c21=30) WHERE c11=40;
DROP TABLE t1, t2;
...@@ -56,7 +56,7 @@ const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25)+(3*4)+4*MAX_SECTION_SIZE); ...@@ -56,7 +56,7 @@ const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25)+(3*4)+4*MAX_SECTION_SIZE);
* information specific to a transporter type. * information specific to a transporter type.
*/ */
struct TransporterConfiguration { struct TransporterConfiguration {
Uint32 port; Int32 s_port; // negative port number implies dynamic port
const char *remoteHostName; const char *remoteHostName;
const char *localHostName; const char *localHostName;
NodeId remoteNodeId; NodeId remoteNodeId;
......
...@@ -271,14 +271,12 @@ IPCConfig::configureTransporters(Uint32 nodeId, ...@@ -271,14 +271,12 @@ IPCConfig::configureTransporters(Uint32 nodeId,
If we're not using dynamic ports, we don't do anything. If we're not using dynamic ports, we don't do anything.
*/ */
if((int)server_port<0)
server_port= -server_port;
conf.localNodeId = nodeId; conf.localNodeId = nodeId;
conf.remoteNodeId = remoteNodeId; conf.remoteNodeId = remoteNodeId;
conf.checksum = checksum; conf.checksum = checksum;
conf.signalId = sendSignalId; conf.signalId = sendSignalId;
conf.port = server_port; conf.s_port = server_port;
conf.localHostName = localHostName; conf.localHostName = localHostName;
conf.remoteHostName = remoteHostName; conf.remoteHostName = remoteHostName;
...@@ -350,7 +348,7 @@ IPCConfig::configureTransporters(Uint32 nodeId, ...@@ -350,7 +348,7 @@ IPCConfig::configureTransporters(Uint32 nodeId,
if (!iter.get(CFG_TCP_PROXY, &proxy)) { if (!iter.get(CFG_TCP_PROXY, &proxy)) {
if (strlen(proxy) > 0 && nodeId2 == nodeId) { if (strlen(proxy) > 0 && nodeId2 == nodeId) {
// TODO handle host:port // TODO handle host:port
conf.port = atoi(proxy); conf.s_port = atoi(proxy);
} }
} }
......
...@@ -290,7 +290,7 @@ TransporterRegistry::createTCPTransporter(TransporterConfiguration *config) { ...@@ -290,7 +290,7 @@ TransporterRegistry::createTCPTransporter(TransporterConfiguration *config) {
config->tcp.maxReceiveSize, config->tcp.maxReceiveSize,
config->localHostName, config->localHostName,
config->remoteHostName, config->remoteHostName,
config->port, config->s_port,
config->isMgmConnection, config->isMgmConnection,
localNodeId, localNodeId,
config->remoteNodeId, config->remoteNodeId,
...@@ -392,7 +392,7 @@ TransporterRegistry::createSCITransporter(TransporterConfiguration *config) { ...@@ -392,7 +392,7 @@ TransporterRegistry::createSCITransporter(TransporterConfiguration *config) {
SCI_Transporter * t = new SCI_Transporter(*this, SCI_Transporter * t = new SCI_Transporter(*this,
config->localHostName, config->localHostName,
config->remoteHostName, config->remoteHostName,
config->port, config->s_port,
config->isMgmConnection, config->isMgmConnection,
config->sci.sendLimit, config->sci.sendLimit,
config->sci.bufferSize, config->sci.bufferSize,
...@@ -458,7 +458,7 @@ TransporterRegistry::createSHMTransporter(TransporterConfiguration *config) { ...@@ -458,7 +458,7 @@ TransporterRegistry::createSHMTransporter(TransporterConfiguration *config) {
SHM_Transporter * t = new SHM_Transporter(*this, SHM_Transporter * t = new SHM_Transporter(*this,
config->localHostName, config->localHostName,
config->remoteHostName, config->remoteHostName,
config->port, config->s_port,
config->isMgmConnection, config->isMgmConnection,
localNodeId, localNodeId,
config->remoteNodeId, config->remoteNodeId,
...@@ -1170,7 +1170,10 @@ TransporterRegistry::do_connect(NodeId node_id) ...@@ -1170,7 +1170,10 @@ TransporterRegistry::do_connect(NodeId node_id)
case DISCONNECTING: case DISCONNECTING:
break; break;
} }
DBUG_ENTER("TransporterRegistry::do_connect");
DBUG_PRINT("info",("performStates[%d]=CONNECTING",node_id));
curr_state= CONNECTING; curr_state= CONNECTING;
DBUG_VOID_RETURN;
} }
void void
TransporterRegistry::do_disconnect(NodeId node_id) TransporterRegistry::do_disconnect(NodeId node_id)
...@@ -1186,21 +1189,30 @@ TransporterRegistry::do_disconnect(NodeId node_id) ...@@ -1186,21 +1189,30 @@ TransporterRegistry::do_disconnect(NodeId node_id)
case DISCONNECTING: case DISCONNECTING:
return; return;
} }
DBUG_ENTER("TransporterRegistry::do_disconnect");
DBUG_PRINT("info",("performStates[%d]=DISCONNECTING",node_id));
curr_state= DISCONNECTING; curr_state= DISCONNECTING;
DBUG_VOID_RETURN;
} }
void void
TransporterRegistry::report_connect(NodeId node_id) TransporterRegistry::report_connect(NodeId node_id)
{ {
DBUG_ENTER("TransporterRegistry::report_connect");
DBUG_PRINT("info",("performStates[%d]=CONNECTED",node_id));
performStates[node_id] = CONNECTED; performStates[node_id] = CONNECTED;
reportConnect(callbackObj, node_id); reportConnect(callbackObj, node_id);
DBUG_VOID_RETURN;
} }
void void
TransporterRegistry::report_disconnect(NodeId node_id, int errnum) TransporterRegistry::report_disconnect(NodeId node_id, int errnum)
{ {
DBUG_ENTER("TransporterRegistry::report_connect");
DBUG_PRINT("info",("performStates[%d]=DISCONNECTED",node_id));
performStates[node_id] = DISCONNECTED; performStates[node_id] = DISCONNECTED;
reportDisconnect(callbackObj, node_id, errnum); reportDisconnect(callbackObj, node_id, errnum);
DBUG_VOID_RETURN;
} }
void void
......
...@@ -7064,7 +7064,7 @@ static COND* substitute_for_best_equal_field(COND *cond, ...@@ -7064,7 +7064,7 @@ static COND* substitute_for_best_equal_field(COND *cond,
List_iterator_fast<Item_equal> it(cond_equal->current_level); List_iterator_fast<Item_equal> it(cond_equal->current_level);
while ((item_equal= it++)) while ((item_equal= it++))
{ {
eliminate_item_equal(cond, cond_equal->upper_levels, item_equal); cond= eliminate_item_equal(cond, cond_equal->upper_levels, item_equal);
} }
} }
} }
...@@ -11790,11 +11790,11 @@ cp_buffer_from_ref(THD *thd, TABLE_REF *ref) ...@@ -11790,11 +11790,11 @@ cp_buffer_from_ref(THD *thd, TABLE_REF *ref)
ref_pointer_array. ref_pointer_array.
RETURN RETURN
0 if OK FALSE if OK
1 if error occurred TRUE if error occurred
*/ */
static int static bool
find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
ORDER *order, List<Item> &fields, List<Item> &all_fields, ORDER *order, List<Item> &fields, List<Item> &all_fields,
bool is_group_field) bool is_group_field)
...@@ -11811,13 +11811,13 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, ...@@ -11811,13 +11811,13 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
{ {
my_error(ER_BAD_FIELD_ERROR, MYF(0), my_error(ER_BAD_FIELD_ERROR, MYF(0),
order_item->full_name(), thd->where); order_item->full_name(), thd->where);
return 1; return TRUE;
} }
order->item= ref_pointer_array + count - 1; order->item= ref_pointer_array + count - 1;
order->in_field_list= 1; order->in_field_list= 1;
order->counter= count; order->counter= count;
order->counter_used= 1; order->counter_used= 1;
return 0; return FALSE;
} }
/* Lookup the current GROUP/ORDER field in the SELECT clause. */ /* Lookup the current GROUP/ORDER field in the SELECT clause. */
uint counter; uint counter;
...@@ -11825,7 +11825,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, ...@@ -11825,7 +11825,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
select_item= find_item_in_list(order_item, fields, &counter, select_item= find_item_in_list(order_item, fields, &counter,
REPORT_EXCEPT_NOT_FOUND, &unaliased); REPORT_EXCEPT_NOT_FOUND, &unaliased);
if (!select_item) if (!select_item)
return 1; /* Some error occured. */ return TRUE; /* The item is not unique, or some other error occured. */
/* Check whether the resolved field is not ambiguos. */ /* Check whether the resolved field is not ambiguos. */
...@@ -11839,7 +11839,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, ...@@ -11839,7 +11839,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
*/ */
if (unaliased && !order_item->fixed && order_item->fix_fields(thd, tables, if (unaliased && !order_item->fixed && order_item->fix_fields(thd, tables,
order->item)) order->item))
return 1; return TRUE;
/* Lookup the current GROUP field in the FROM clause. */ /* Lookup the current GROUP field in the FROM clause. */
order_item_type= order_item->type(); order_item_type= order_item->type();
...@@ -11879,27 +11879,42 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, ...@@ -11879,27 +11879,42 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
{ {
order->item= ref_pointer_array + counter; order->item= ref_pointer_array + counter;
order->in_field_list=1; order->in_field_list=1;
return 0; return FALSE;
} }
else
/*
There is a field with the same name in the FROM clause. This is the field
that will be chosen. In this case we issue a warning so the user knows
that the field from the FROM clause overshadows the column reference from
the SELECT list.
*/
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_NON_UNIQ_ERROR,
ER(ER_NON_UNIQ_ERROR), from_field->field_name,
current_thd->where);
} }
order->in_field_list=0; order->in_field_list=0;
/* /*
The call to order_item->fix_fields() means that here we resolve 'order_item'
to a column from a table in the list 'tables', or to a column in some outer
query. Exactly because of the second case we come to this point even if
(select_item == not_found_item), inspite of that fix_fields() calls
find_item_in_list() one more time.
We check order_item->fixed because Item_func_group_concat can put We check order_item->fixed because Item_func_group_concat can put
arguments for which fix_fields already was called. arguments for which fix_fields already was called.
'it' reassigned in if condition because fix_field can change it.
*/ */
if (!order_item->fixed && if (!order_item->fixed &&
(order_item->fix_fields(thd, tables, order->item) || (order_item->fix_fields(thd, tables, order->item) ||
(order_item= *order->item)->check_cols(1) || (order_item= *order->item)->check_cols(1) ||
thd->is_fatal_error)) thd->is_fatal_error))
return 1; // Wrong field return TRUE; /* Wrong field. */
uint el= all_fields.elements; uint el= all_fields.elements;
all_fields.push_front(order_item); // Add new field to field list all_fields.push_front(order_item); /* Add new field to field list. */
ref_pointer_array[el]= order_item; ref_pointer_array[el]= order_item;
order->item= ref_pointer_array + el; order->item= ref_pointer_array + el;
return 0; return FALSE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment