Re: Foreign Key Problem

2010-06-22 Thread Victor Subervi
On Tue, Jun 22, 2010 at 11:53 AM, jayabharath wrote: > Hi Victor, > > The actual problem is with the key field. > > Flights.pilot_id is set to INT NOT NULL and you had specified Pilots.id to > INT NULL. > > You have to change both the columns to NULL or else NOT NULL to avoid the > error. > Than

Re: Foreign Key Problem

2010-06-22 Thread jayabharath
Hi Victor, The actual problem is with the key field. Flights.pilot_id is set to INT NOT NULL and you had specified Pilots.id to INT NULL. You have to change both the columns to NULL or else NOT NULL to avoid the error. Regards, Jay MySQL DBA Datavail CORP On Tue, Jun 22, 2010 at 7:45 PM, Victo

Re: Foreign Key Problem

2010-06-22 Thread Victor Subervi
Problem solved. I tried everything that *should* have worked and didn't. Then I just wiped the test database and started with everything *fixed* (all engine=innodb, all keys of same type, etc.) and it all worked. V

Foreign Key Problem

2010-06-22 Thread Victor Subervi
Hi; mysql> alter table Flights type=InnoDB; Query OK, 1 row affected, 1 warning (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> alter table Flights add pilot_id int not null; Query OK, 1 row affected (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> alter table Flights add foreig

Re: Foreign Key Problem

2010-05-22 Thread Victor Subervi
This is just for the sake of future googlers of this thread. The correct mysql command is: ursor.execute('create table if not exists Passengers (id int(11) auto_increment primary key, flights_id int(11) not null, customer_id int(11) not null, foreign key (flights_id) references Flights (id), forei

Re: Another Foreign Key Problem

2010-05-21 Thread Victor Subervi
I'm canceling this thread. It belongs in the Python list. Sorry! V On Fri, May 21, 2010 at 1:24 PM, Victor Subervi wrote: > Hi; > When I try to execute this code from my Python script, I get this error: > > Traceback (most recent call last): > File > "/var/www/html/creative.vi/clients/sea-flig

Another Foreign Key Problem

2010-05-21 Thread Victor Subervi
Hi; When I try to execute this code from my Python script, I get this error: Traceback (most recent call last): File "/var/www/html/creative.vi/clients/sea-flight/reservations/create_edit_bags3.py", line 38, in ? create_edit_bags3() File "/var/www/html/creative.vi/clients/sea-flight/rese

Re: Foreign Key Problem

2010-05-20 Thread Victor Subervi
On Wed, May 19, 2010 at 12:02 PM, Shawn Green wrote: > Victor Subervi wrote: > >> On Wed, May 19, 2010 at 10:59 AM, Shawn Green > >wrote: >> >> Shawn Green wrote: >> >> > look again closely at your FK definitions. The pattern should be >>> >> > FOREIGN KEY (child_table_column) REFERENCES > paren

Re: Foreign Key Problem

2010-05-19 Thread Shawn Green
Victor Subervi wrote: On Wed, May 19, 2010 at 10:59 AM, Shawn Green wrote: Shawn Green wrote: AH! that's your mistake. You think that creating the FK will also create the column. That does not happen. You have to define the table completely before you can associate the columns on this table (t

Re: Foreign Key Problem

2010-05-19 Thread Victor Subervi
On Wed, May 19, 2010 at 10:59 AM, Shawn Green wrote: > Shawn Green wrote: > > AH! that's your mistake. You think that creating the FK will also create > the column. That does not happen. You have to define the table completely > before you can associate the columns on this table (the child table)

Re: Foreign Key Problem

2010-05-19 Thread Shawn Green
Victor Subervi wrote: On Tue, May 18, 2010 at 2:23 PM, Shawn Green wrote: Shawn Green wrote: I may be confused but how can the ID of the Passengers table be both the ID of the Flight they are taking and their Customer ID at the same time? http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-k

Re: Foreign Key Problem

2010-05-19 Thread Victor Subervi
On Tue, May 18, 2010 at 2:23 PM, Shawn Green wrote: > Shawn Green wrote: > I may be confused but how can the ID of the Passengers table be both the ID > of the Flight they are taking and their Customer ID at the same time? > > http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.h

Re: Foreign Key Problem

2010-05-18 Thread Shawn Green
Victor Subervi wrote: On Tue, May 18, 2010 at 1:09 PM, Shawn Green > wrote: Johan De Meersman wrote: For additional details about failed FK attempts, check the error details in the SHOW INNODB STATUS report. I get this: 100518 10:26:22 Error i

Re: Foreign Key Problem

2010-05-18 Thread Victor Subervi
On Tue, May 18, 2010 at 1:09 PM, Shawn Green wrote: > Johan De Meersman wrote: > > For additional details about failed FK attempts, check the error details in > the SHOW INNODB STATUS report. > I get this: 100518 10:26:22 Error in foreign key constraint of table seaflight/Passengers: constrain

Re: Foreign Key Problem

2010-05-18 Thread Shawn Green
Johan De Meersman wrote: On Tue, May 18, 2010 at 6:00 PM, Victor Subervi wrote: So apparently it didn't like my foreign key. Do I need to do something with the table I'm referencing or what? TIA. Well, quickfix is to convert your tables to innoDB, starting with the lowest-level (foreign-key

Re: Foreign Key Problem

2010-05-18 Thread Johan De Meersman
On Tue, May 18, 2010 at 6:00 PM, Victor Subervi wrote: > > > So apparently it didn't like my foreign key. Do I need to do something with > the table I'm referencing or what? > TIA. > Well, quickfix is to convert your tables to innoDB, starting with the lowest-level (foreign-key only ones) first -

Re: Foreign Key Problem

2010-05-18 Thread Victor Subervi
On Tue, May 18, 2010 at 10:06 AM, Johan De Meersman wrote: > You're not specifying an engine, and the default is MyISAM, which doesn't > support foreign keys and will likely silently ignore requests for them. Can > you confirm that you've changed the default engine to InnoDB ? Got me. No, it was

Re: Foreign Key Problem

2010-05-18 Thread Johan De Meersman
You're not specifying an engine, and the default is MyISAM, which doesn't support foreign keys and will likely silently ignore requests for them. Can you confirm that you've changed the default engine to InnoDB ? On Tue, May 18, 2010 at 3:44 PM, Victor Subervi wrote: > Hi; > mysql> create table i

Foreign Key Problem

2010-05-18 Thread Victor Subervi
Hi; mysql> create table if not exists Passengers (id int unsigned auto_increment primary key, foreign key (id) references Flights (flights_id), foreign key (id) references Customers (customer_id), name varchar(40), weight tinyint(3)); Query OK, 0 rows affected (0.00 sec) mysql> select c.first_name

Re: foreign key problem

2004-10-04 Thread SGreen
Whenever you get an INNODB error, you can get more details by running a SHOW INNODB STATUS. A foreign key means that a value must exist in one table before it can be used as a value in another table. That's probably why you couldn't add a record to Table2 before you had a value in Table1. The c

Re: foreign key problem

2004-10-03 Thread Stuart Felenstein
I think I may have discovered one of my issues, is memberID in Table2 was primary key. Should not have been. As far as the error messages in removing key, I'm still unsure. Stuart --- Stuart Felenstein <[EMAIL PROTECTED]> wrote: > Two tables: > > Table1 [innodb] > userID. > addtlfields

foreign key problem

2004-10-03 Thread Stuart Felenstein
Two tables: Table1 [innodb] userID. addtlfields. Table2 [innodb] memberID. addtlfields. I created a foreign key in Table2 for memberID to userID set to "no action" on both delete and update. I get this error when I try to add a record to table 2:"Cannot add or update a child ro

re: FOREIGN KEY problem

2003-02-19 Thread Victoria Reznichenko
On Wednesday 19 February 2003 10:46, [EMAIL PROTECTED] wrote: > I have problems with foreign key creation. > I have installed mysql server cersion 3.23.53 on red hat linux 7.3. > Then I have created innodb datebase to be able to use FOREIGN KEY > Constarints. > This is concerning piece of my my.cn

FOREIGN KEY problem

2003-02-19 Thread [EMAIL PROTECTED]
Hi everybody, I have problems with foreign key creation. I have installed mysql server cersion 3.23.53 on red hat linux 7.3. Then I have created innodb datebase to be able to use FOREIGN KEY Constarints. This is concerning piece of my my.cnf file: # Uncomment the following if you are using InnoDB

Re: foreign key problem

2003-01-22 Thread Heikki Tuuri
Saju, - Original Message - From: "Victoria Reznichenko" <[EMAIL PROTECTED]> Newsgroups: mailing.database.mysql Sent: Tuesday, January 21, 2003 4:27 PM Subject: re: foreign key problem > On Tuesday 21 January 2003 09:56, Saju Pappachen wrote: > > In my MySQL I ha

Re: re: foreign key problem

2003-01-22 Thread Victoria Reznichenko
On Wednesday 22 January 2003 06:03, you wrote: > Hi Victoria > > Even when I used InnoDB, it doesn't support foriegh key. It allows me to > insert data into child table without being entered to parent table. Check that your both tables are InnoDB with SHOW TABLE STATUS command. Show me an example

re: foreign key problem

2003-01-21 Thread Victoria Reznichenko
On Tuesday 21 January 2003 09:56, Saju Pappachen wrote: > In my MySQL I have 3 tables like this and I have a pblm. in setting the > foreign key.Pls. help [skip] > create table employee_skill_details(EMP_ID int(10) not null references > employee_details(EMP_ID), SKILL_ID varchar(5) not null refere

foreign key problem

2003-01-21 Thread Saju Pappachen
In my MySQL I have 3 tables like this and I have a pblm. in setting the foreign key.Pls. help EMPLOYEE_DETAILS EMP_ID - PKint(10) EMP_FIRST_NAMEvarchar(25) EMP_LAST_NAMEvarchar(25) EMP_CURR_ADDRvarchar(100) EMP_PERM_ADDRvarchar(100) EMP_PHONEvarchar(20) EMP_DOJ

Re: Foreign Key problem? in MySQL 4.0.7

2003-01-03 Thread Heikki Tuuri
Haisam, - Original Message - From: ""Haisam K. Ido"" <[EMAIL PROTECTED]> Newsgroups: mailing.database.mysql Sent: Friday, January 03, 2003 2:01 AM Subject: Re: Foreign Key problem? in MySQL 4.0.7 > Heikki: > > Do you mean the PRIMARY KEY order? >&

Re: Foreign Key problem? in MySQL 4.0.7

2003-01-02 Thread Haisam K. Ido
Heikki: Do you mean the PRIMARY KEY order? Heikki Tuuri wrote: Haisam, - Original Message - From: ""Haisam K. Ido"" <[EMAIL PROTECTED]> Newsgroups: mailing.database.mysql Sent: Wednesday, January 01, 2003 10:29 PM Subject: Foreign Key problem? in MySQL 4.0.

Re: Foreign Key problem? in MySQL 4.0.7

2003-01-02 Thread Heikki Tuuri
Haisam, - Original Message - From: ""Haisam K. Ido"" <[EMAIL PROTECTED]> Newsgroups: mailing.database.mysql Sent: Wednesday, January 01, 2003 10:29 PM Subject: Foreign Key problem? in MySQL 4.0.7 > I was able to create the "gid" table with no pro

Foreign Key problem? in MySQL 4.0.7

2003-01-01 Thread Haisam K. Ido
I was able to create the "gid" table with no problem under mysql 4.0.7 CREATE TABLE gid ( id INT(11) NOT NULL auto_increment, groupname VARCHAR(128) NOT NULL, passwd VARCHAR(128) NULL, gidINT(11) NOT NULL, username VARCHAR(128) NULL,

foreign key problem

2002-03-04 Thread Asit Satpathy
hello i creates two table t1 and t2; CREATE TABLE t1 ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) TYPE=InnoDB; CREATE TABLE t2 ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, t1id INT UNSIGNED NOT NULL, PRIMARY KEY (id), KEY (t1id), FOREIGN KEY (