2nd connection/cursor to different database with same table names on same server, uses wrong default database to select from same table name
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oursql |
New
|
Undecided
|
Unassigned |
Bug Description
Platform: Centos 6.3, Mysql server 5.5.25, Oursql 0.9.2, python 2.6
Code:
#mysql connection strings
user='feederapp'
passwd ='******'
host ='localhost'
db ='kidon_mailing'
old_db='mailing'
db=mdb.
old_db=
with db.cursor(
with db.cursor(
#get id, filenames from creatives table
dbc.execute(
#this does not execute on old_db's database 'mailing' instead it #incorrectly uses db's database 'kidon_mailing'
old_dbc.
Output:
dbc.execute('SELECT id,filename from creatives') correctly returns:
'2', 'a7be4ffdcca8e5
'3', '80946164dbc8da
While old_dbc.
'2', 'a7be4ffdcca8e5
'3', '80946164dbc8da
Instead of:
'1094', 'eef47e724fb74e
'1095',
Mysql schema's:
Database 'mailing'
CREATE TABLE `creatives` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`offer_id` int(11) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`filename` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
`thumb_filename` varchar(255) NOT NULL,
`thumb_url` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `offer_id` (`offer_id`),
CONSTRAINT `creatives_ibfk_1` FOREIGN KEY (`offer_id`) REFERENCES `offers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2281 DEFAULT CHARSET=utf8$$
Table content:
'1094', '318', NULL, 'eef47e724fb74e
'1095', '319', NULL, '69219255d4d46d
Database 'kidon_mailing':
CREATE TABLE `creatives` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`offer_id` int(11) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`filename` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
`thumb_filename` varchar(255) NOT NULL,
`thumb_url` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `offer_id` (`offer_id`),
CONSTRAINT `creatives_ibfk_1` FOREIGN KEY (`offer_id`) REFERENCES `offers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2281 DEFAULT CHARSET=utf8$$
Table Content:
'2', '1', NULL, 'a7be4ffdcca8e5
'3', '1', NULL, '80946164dbc8da
description: | updated |
description: | updated |
summary: |
2nd connection/cursor to different database with same table names on - same server, uses wrong default databse to select from same table name + same server, uses wrong default database to select from same table name |
description: | updated |