Re: Algorithm for resolving foreign key dependencies?

2009-02-03 Thread Peter Brawley
FROM information_schema.table_constraints AS c INNER JOIN information_schema.key_column_usage AS u USING( constraint_schema, constraint_name ) WHERE c.constraint_type = 'FOREIGN KEY' AND u.referenced_table_schema='db' AND u.referenced_table_name = 'tbl' ORDER BY c.table_schema,u.table_name; | PB

Primary key / foreign key question

2008-11-10 Thread Steve Grosz
Ok, I'm a little new a this, so be gentle!! :) I was looking into the InnoDB engine for some tables I have, and would like to use the PK/FK on some of the data. It appears that the PK/FK is mainly used for updating/deleting data, correct? I can't use it to retreive data from multiple tables

Re: Primary key / foreign key question

2008-11-10 Thread Martijn Tonies
Hello Steve, Ok, I'm a little new a this, so be gentle!! :) I was looking into the InnoDB engine for some tables I have, and would like to use the PK/FK on some of the data. It appears that the PK/FK is mainly used for updating/deleting data, correct? I can't use it to retreive data from

Help with query to remove all records where foreign key doesn't have corresponding records

2008-08-13 Thread Daevid Vincent
I want to remove all records from 'feed_tag' where the feed_id foreign key doesn't have any corresponding records in feed. For instance I may have a record in feed_tag that is like (23, 10, 4543, '... (some date)'). Then lets say there is no record in feed that has a primary id key of 10. I

Re: Help with query to remove all records where foreign key doesn't have corresponding records

2008-08-13 Thread Isart Montane
Hi Daevid If you are using a foreign key you can set the reference as cascade and when a row is deleted from feed it will be deleted from feed_tag. http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html If you don't like it you can delete it easy with a query like

Re: Help with query to remove all records where foreign key doesn't have corresponding records

2008-08-13 Thread Brent Baisley
: I want to remove all records from 'feed_tag' where the feed_id foreign key doesn't have any corresponding records in feed. For instance I may have a record in feed_tag that is like (23, 10, 4543, '... (some date)'). Then lets say there is no record in feed that has a primary id key of 10

Normalization / Foreign Key Question

2008-07-14 Thread Ben A. Hilleli
primary key. My question pertains to referrerID. The referrerID specifies which OTHER USER referred this new user. Thus it is a foreign key that links to a userID in another user record. I do not recall ever linking attributes from the same table (even for different records) so I have a hunch

foreign key cautions

2008-06-17 Thread Sharique uddin Ahmed Farooqui
HI, What are the caution should be taken when designing a db regarding foreign key? I have user table , from which userid is taken as reference in many tables, is it ok? -- Sharique uddin Ahmed Farooqui (C++/C# Developer, IT Consultant) http://safknw.blogspot.com/ Peace is the Ultimate thing we

Falcon and Foreign Key Constraints

2007-09-20 Thread Martijn Tonies
Hi, I thought that Falcon supported FKs, but in my test, it doesn't? Can someone confirm this? Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle MS SQL Server Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/

Re: Falcon and Foreign Key Constraints

2007-09-20 Thread Jim Winstead
On Thu, Sep 20, 2007 at 11:20:19AM +0200, Martijn Tonies wrote: I thought that Falcon supported FKs, but in my test, it doesn't? Can someone confirm this? The Falcon storage engine does not currently support foreign keys. (The underlying engine does have support for them, but this

Re: Falcon and Foreign Key Constraints

2007-09-20 Thread Martijn Tonies
On Thu, Sep 20, 2007 at 11:20:19AM +0200, Martijn Tonies wrote: I thought that Falcon supported FKs, but in my test, it doesn't? Can someone confirm this? The Falcon storage engine does not currently support foreign keys. (The underlying engine does have support for them, but this

Foreign key constraints - Known issues ?

2007-07-19 Thread Ratheesh K J
Hello All, I just wanted to know whether there are any known issues in defining and using Foreign key constraints in MySQL 4 and MySQL 5. To be specific, are there any issues on using ON DELETE CASCADE and ON UPDATE CASCADE? Would there be any performance issues when we define Foreign key

Re: Foreign key constraints - Known issues ?

2007-07-19 Thread Martijn Tonies
I just wanted to know whether there are any known issues in defining and using Foreign key constraints in MySQL 4 and MySQL 5. To be specific, are there any issues on using ON DELETE CASCADE and ON UPDATE CASCADE? Would there be any performance issues when we define Foreign key constraints? We

Help with Migration/Foreign Key

2007-05-23 Thread Chris Hoover
I need some help. I am under presure from management to migrate and existing Sybase ASA database to Mysql for a proof of concept. I have done most of the work, but am having an issue creating a foreign key. I keep getting the Can't create table './mysqk/#sql-d70_1f.frm' (errno: 150) error. I

Re: Help with Migration/Foreign Key

2007-05-23 Thread Baron Schwartz
Hi Chris, Chris Hoover wrote: I need some help. I am under presure from management to migrate and existing Sybase ASA database to Mysql for a proof of concept. I have done most of the work, but am having an issue creating a foreign key. I keep getting the Can't create table './mysqk/#sql

Re: Help with Migration/Foreign Key

2007-05-23 Thread Chris Hoover
Here is the error from the show innodb status: 070523 15:39:39 Error in foreign key constraint of table mysql/#sql-d70_22: FOREIGN KEY (tab_id, class) REFERENCES system_tabs(tab_id, class): Cannot find an index in the referenced table where the referenced columns appear as the first columns

Re: Help with Migration/Foreign Key

2007-05-23 Thread Baron Schwartz
Hi Chris, Chris Hoover wrote: Here is the error from the show innodb status: 070523 15:39:39 Error in foreign key constraint of table mysql/#sql-d70_22: FOREIGN KEY (tab_id, class) REFERENCES system_tabs(tab_id, class): Cannot find an index in the referenced table where the referenced

Re: Create Foreign Key Issue

2007-05-19 Thread Jesse
Check the output of SHOW INNODB STATUS. You should see a more helpful error message there. This shows the following information: LATEST FOREIGN KEY ERROR 070519 15:15:28 Error in foreign key constraint of table woodturners/#sql-2dc_1e

Create Foreign Key Issue

2007-05-18 Thread Jesse
Currently using MySQL version 5.0.22-community-nt on a Windows XP Pro box (my development machine). When I attempt to add a Foreign Key to one of my tables, I get the error, Can't create table '.\woodturners\#sql-2dc_8.frm' (errno: 150). I have checked through all of the standard issues

Re: Create Foreign Key Issue

2007-05-18 Thread Baron Schwartz
Hi Jesse, Jesse wrote: Currently using MySQL version 5.0.22-community-nt on a Windows XP Pro box (my development machine). When I attempt to add a Foreign Key to one of my tables, I get the error, Can't create table '.\woodturners\#sql-2dc_8.frm' (errno: 150). I have checked through all

one-to-one relation, foreign key creation

2007-04-21 Thread Thufir
I want contacts to have a 1-1 relation to px_items. I'm hesitant to add the contact info onto px_items because http://www.feedonfeeds.com/ uses that table. from phpMyAdmin, how would I re-organize things pls? Or, must I manually enter the SQL to establish the foreign key part? Once I have

Mysql and FOREIGN KEY

2007-02-21 Thread Micol lupen
Hi to all, I am a student, i am studing Mysql FOREIGN KEY for to do a little progect, but i have this problem: i create this table: CREATE TABLE Cliente( codcliente VARCHAR(6) NOT NULL, nome VARCHAR(10) NOT NULL,cognome VARCHAR(20) NOT NULL, citta VARCHAR(10), indirizzo VARCHAR(20), tel VARCHAR(7

Re: Mysql and FOREIGN KEY

2007-02-21 Thread Gerald L. Clark
Micol lupen wrote: Hi to all, I am a student, i am studing Mysql FOREIGN KEY for to do a little progect, but i have this problem: i create this table: CREATE TABLE Cliente( codcliente VARCHAR(6) NOT NULL, nome VARCHAR(10) NOT NULL,cognome VARCHAR(20) NOT NULL, citta VARCHAR(10), indirizzo

Re: Mysql and FOREIGN KEY

2007-02-21 Thread Nils Meyer
Hi, Micol lupen wrote: FOREIGN KEY(of_idvillaggio),REFERENCES villaggio(idvillaggio) ^^^ check here! ON UPDATE CASCADE ON DELETE RESTRICT)ENGINE=INNODB; No comma before REFERENCES. REFERENCES is part of the foreign key definition. regards Nils -- MySQL General

Add foreign key

2007-01-09 Thread Mungbeans
Still on the top of foreign keys :) I have this statement: ALTER TABLE `mytable` ADD FOREIGN KEY ( `id` ) REFERENCES `othertable` ( `id` ); Is there a way I can give this key a specific name (eg 'FK_mytable_id') and specific the type of reference (eg 'ON UPDATE CASCADE')? -- View

Re: Add foreign key

2007-01-09 Thread Mungbeans
Just found this added the name: ALTER TABLE `mytable` ADD FOREIGN KEY `fk_mytable_id` ( `id` ) REFERENCES `othertable` ( `id` ); I thought I had tried that - obviously not. -- View this message in context: http://www.nabble.com/Add-foreign-key-tf2950373.html#a8251427 Sent from the MySQL

Re: Add foreign key

2007-01-09 Thread Mungbeans
And here are the matching drop and create statements: ALTER TABLE `mytable` DROP FOREIGN KEY `fk_mytable_id`; ALTER TABLE `mytable` ADD CONSTRAINT `fk_mytable_id` FOREIGN KEY ( `id` ) REFERENCES `anothertable` ( `id` ) ON UPDATE CASCADE ON DELETE RESTRICT; I don't know what I was doing

Re: Deleting Foreign Key

2007-01-04 Thread Heikki Tuuri
keys for MySQL InnoDB Hot Backup - a hot backup tool for InnoDB which also backs up MyISAM tables http://www.innodb.com/order.php . From: Mungbeans Date: January 2 2007 12:56am Subject: Deleting Foreign Key Get Plain Text I have a foreign key in a table which I need to drop. I have

Re: Deleting Foreign Key

2007-01-04 Thread Chris White
Mungbeans wrote: ALTER TABLE `mytable` DROP FOREIGN KEY `keyname` #1025 - Error on rename of '.\database\mytable' to '.\database\#sql2-6ec-11' (errno: 152) ALTER TABLE `mytable` DROP INDEX `keyname` #1025 - Error on rename of '.\database\#sql-6ec_13' to '.\database\mytable' (errno: 150 Oh

Re: Deleting Foreign Key

2007-01-04 Thread Mungbeans
Chris White-4 wrote: Moving along... what I do first is SHOW CREATE TABLE `table_name`: ...snipped... So, first you remove the key: ALTER TABLE table_name DROP KEY `key_column`; then the foreign key: ALTER TABLE table_name DROP FOREIGN KEY `table_name_ibfk_1`; ...snipped... Thank

Deleting Foreign Key

2007-01-01 Thread Mungbeans
I have a foreign key in a table which I need to drop. I have successfully dropped other foreign keys from this table using phpMyAdmin. However when I use these commands I get similar error messages: ALTER TABLE `mytable` DROP FOREIGN KEY `keyname` #1025 - Error on rename of '.\database

RE: Copy some datasets including the foreign key constraints

2006-11-27 Thread Jerry Schwartz
I am not an expert in this, but it looks as though you are trying to define foreign keys on your parent table. I thought you had to define the parent table without foreign keys, and then define a child table with foreign key constraints. I'm also not sure if you are trying to redefine the key

AW: Copy some datasets including the foreign key constraints

2006-11-23 Thread Eidner, Fabian
`),\n KEY `demo_employee_FKIndex3` (`demo_biz_role_idbiz_role`),\n KEY `demo_employee_FKIndex4` (`demo_job_idjob`),\n KEY `demo_employee_FKIndex5` (`demo_user_iduser`),\n CONSTRAINT `demo_employee_ibfk_1` FOREIGN KEY (`demo_mandt_idmandt`) REFERENCES `demo_mandt` (`idmandt`) ON DELETE CASCADE

Copy some datasets including the foreign key constraints

2006-11-22 Thread Eidner, Fabian
Hello list, I'm pretty new here. But i already got an problem. I'm working a while with mysql currently i'm trying to duplicate some entries in my tables. The problem is, i'm using foreign key constraints between those tables and i also would like to duplicate the childs. So i got one big parent

RE: Copy some datasets including the foreign key constraints

2006-11-22 Thread Jerry Schwartz
@lists.mysql.com Subject: Copy some datasets including the foreign key constraints Hello list, I'm pretty new here. But i already got an problem. I'm working a while with mysql currently i'm trying to duplicate some entries in my tables. The problem is, i'm using foreign key constraints between those

Find foreign key for a table

2006-11-14 Thread Clyde Lewis
Hello, How can I find the foreign keys for a table? I would like to be able to find, for any table, the columns that are foreign keys and what tables/columns the foreign keys are related to. Basically what I am trying to do is this. My developers want to allow logical deletes of data. I don't

RE: Find foreign key for a table

2006-11-14 Thread Clyde Lewis
wrote: show create table tablename? -Original Message- From: Clyde Lewis [mailto:[EMAIL PROTECTED]mailto:[EMAIL PROTECTED] Sent: Tue 11/14/2006 10:16 AM To: MySQL List Subject: Find foreign key for a table Hello, How can I find the foreign keys for a table? I would like to be able

RE: Find foreign key for a table

2006-11-14 Thread Waldemar Jankowski
To: MySQL List Subject: Find foreign key for a table Hello, How can I find the foreign keys for a table? I would like to be able to find, for any table, the columns that are foreign keys and what tables/columns the foreign keys are related to. Basically what I am trying to do is this. My developers

Re: Find foreign key for a table

2006-11-14 Thread Peter Brawley
Clyde, How can I find the foreign keys for a table? At http://www.artfulsoftware.com/mysql-queries.php in the left pane click on DDL then on 'Find parent tables'. HTH. PB - Hello, How can I find the foreign keys for a table? I would like to be able to find, for any table, the

RE: Find foreign key for a table

2006-11-14 Thread Tim Lucia
To: Clyde Lewis Cc: MySQL List Subject: Re: Find foreign key for a table Clyde, How can I find the foreign keys for a table? At http://www.artfulsoftware.com/mysql-queries.php in the left pane click on DDL then on 'Find parent tables'. HTH. PB - Hello, How can I find the foreign keys

Re: Foreign Key MATCH constraint

2006-11-10 Thread Giorgio Zarrelli
Alle 14:04, giovedì 9 novembre 2006, Heikki Tuuri ha scritto: Giorgio, InnoDB only implements MATCH SIMPLE. MySQL/InnoDB ignores the MATCH clause that you specify in the foreign key constraint definition. Thanks a lot :-) Giorgio -- MySQL General Mailing List For list archives: http

Re: Foreign Key MATCH constraint

2006-11-09 Thread Heikki Tuuri
Giorgio, InnoDB only implements MATCH SIMPLE. MySQL/InnoDB ignores the MATCH clause that you specify in the foreign key constraint definition. http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt A referential constraint is satisfied if one of the following con

Foreign Key MATCH constraint

2006-11-03 Thread Giorgio Zarrelli
that are done during insertion into a referencing table. So they can be implemented by a simple check which is to be done at the beggining of the trigger which is responsible for processing of a foreign key check on insertion: * if the match type is SIMPLE and one or more foreign key columns in the row

Foreign Key MATCH constraint

2006-11-03 Thread Giorgio Zarrelli
that are done during insertion into a referencing table. So they can be implemented by a simple check which is to be done at the beggining of the trigger which is responsible for processing of a foreign key check on insertion: * if the match type is SIMPLE and one or more foreign key columns in the row

re: foreign key not able to be made

2006-10-05 Thread James Black
TABLE `cardfaces` ADD CONSTRAINT `fk_card_deck` FOREIGN KEY (`card_id`) references card(`id`); ALTER TABLE `cards` ADD CONSTRAINT `fk_card_deck` FOREIGN KEY (`deck_id`) referencesdeck(`id`); ALTER TABLE `decks` ADD CONSTRAINT `fk_deck_cardtype` FOREIGN KEY (`cardtype_id` REFERENCES cardtypes(`id

Re: re: foreign key not able to be made

2006-10-05 Thread Dan Buettner
James, you may have a typo in your SQL, actually in the the frst two ALTER TABLE statements. You posted: ALTER TABLE `cardfaces` ADD CONSTRAINT `fk_card_deck` FOREIGN KEY (`card_id`) references card(`id`); ALTER TABLE `cards` ADD CONSTRAINT `fk_card_deck` FOREIGN KEY (`deck_id`) referencesdeck

Regarding multiple foreign key - confliciting - definitions in a single table

2006-10-02 Thread Woronoff, Noga
` (`topic_cd_id`), UNIQUE KEY `r180_student_idx_04` (`user_id`), CONSTRAINT `0_3834` FOREIGN KEY (`topic_cd_id`) REFERENCES `r180_topic_cd` (`topic_cd_id`) ON DELETE RESTRICT, CONSTRAINT `0_3836` FOREIGN KEY (`user_id`) REFERENCES `ic_user` (`user_id`) ON DELETE CASCADE ) TYPE=InnoDB COMMENT

Re: Adding Foreign Key Fails

2006-07-27 Thread mark addison
On Wed, 2006-07-26 at 08:58 -0400, Jesse wrote: I am trying to add a foreign key to one of my tables. When I execute the following SQL Code: ALTER TABLE `bpa`.`confinvitems` ADD CONSTRAINT `FK_confinvitems_1` FOREIGN KEY `FK_confinvitems_1` (`InvDetID`) REFERENCES `confinvdet` (`ID

Re: Adding Foreign Key Fails

2006-07-27 Thread Jesse
By that I hope you mean there is an index on confinvitems.InvDetID _and_ confinvdet.ID Yes, there is. Could be a record in confinvitems that has an InvDetID that doesn't exist in ConfInvDet. Check with something like: SELECT InvDetID FROM confinvitems WHERE InvDetID NOT IN (SELECT ID FROM

newbie..foreign key clarification

2006-07-27 Thread Grass Cake
I'm still unsure about foreign keys..even after reading the doc file and Paul Dubois 3rd edition My doubt is...how much constraint is applied.( probably a bad explanation) If i have a table 'Customers' with the primary key being 'CustID' Then i have a table 'LastVisit' with a foreign key

Re: newbie..foreign key clarification

2006-07-27 Thread Chris
' with a foreign key 'CustID' btw...i have a Form-SubForm in OO that i'm working with where i have the 2 tables linked should the foreign key 'LastVisit.CustID' only allow values that are in the linked primary field? or will it allow any value that is in the table ' Customers.CustID' ? When i enter

Adding Foreign Key Fails

2006-07-26 Thread Jesse
I am trying to add a foreign key to one of my tables. When I execute the following SQL Code: ALTER TABLE `bpa`.`confinvitems` ADD CONSTRAINT `FK_confinvitems_1` FOREIGN KEY `FK_confinvitems_1` (`InvDetID`) REFERENCES `confinvdet` (`ID`) ON DELETE CASCADE; I get the error: MySQL Error Number

Re: Adding Foreign Key Fails

2006-07-26 Thread Dilipkumar
Hi, Is this a InnoDB table. Thanks Regards Dilipkumar - Original Message - From: Jesse [EMAIL PROTECTED] To: MySQL List mysql@lists.mysql.com Sent: Wednesday, July 26, 2006 6:28 PM Subject: Adding Foreign Key Fails I am trying to add a foreign key to one of my tables. When I

Re: Adding Foreign Key Fails

2006-07-26 Thread Jesse
Is this a InnoDB table. Yes, sorry, I should have mentioned that. The rest of my tables are MyISAM, and I discovered that it does not support Foreign Keys. So, I converted these tables to InnoDB so that I can put the Foreign Keys in. Thanks, Jesse -- MySQL General Mailing List For list

Error when creating Foreign Key

2006-07-19 Thread Jesse
I'm using MySQL 5 with InnoDB tables. I'm trying to create a foreign key, but when I try, it's giving me an error. I've tried this with the MySQLQuery Browser, and EMS SQL Manager 2005. I get the following error in the Query Browser: Error while executing query. ALTER TABLE `karate

Re: Error when creating Foreign Key

2006-07-19 Thread Dan Buettner
Jesse, a stab in the dark here, with some info from the manual. A foreign key constraint is in My Code erroneously coded, If MySQL gives the error number 1005 from a CREATE TABLE statement, and the error message string refers to errno 150, then the table creation failed because a foreign key

Re: Error when creating Foreign Key

2006-07-19 Thread Jesse
line, eliminating the reference to the karate database, and got the same error. I tried the SHOW INNODBSTATUS. I did find something in there that may hint at the problem: 060719 14:07:40 Error in foreign key constraint of table karate/#sql-304_12: FOREIGN KEY FK_custpoints_1 (CTID) REFERENCES

Re: Error when creating Foreign Key

2006-07-19 Thread Chris White
On Wednesday 19 July 2006 10:25 am, Jesse wrote: MySQL Error Number 1005 Can't create table '.\karate\#sql-304_9.frm' (errno: 150) KEY `FK_custpoints_1` (`CTID`) REFERENCES `custtournaments` (`ID`) can you show us the column declarations for these two? Any idea why this is happening, and

Re: Error when creating Foreign Key

2006-07-19 Thread Jesse
[EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Wednesday, July 19, 2006 2:33 PM Subject: Re: Error when creating Foreign Key On Wednesday 19 July 2006 10:25 am, Jesse wrote: MySQL Error Number 1005 Can't create table '.\karate\#sql-304_9.frm' (errno: 150) KEY `FK_custpoints_1` (`CTID

Re: Error when creating Foreign Key

2006-07-19 Thread Chris White
On Wednesday 19 July 2006 01:07 pm, Jesse wrote:   `ID` int(10) unsigned NOT NULL auto_increment,   `CTID` int(11) NOT NULL, the storage types aren't the same. change CTID to INT(10) UNSIGNED NOT NULL and it should work. -- Chris White PHP Programmer/DBank Interfuel -- MySQL General

foreign key creation on MyISAM storage engine

2006-03-28 Thread Taco Fleur
HI, I previously tried this same question on the GUI tool list, but not much traffic there, so I thought I'd give it a go here. I've been reading some articles that suggest I should be able to create a relationship on a MyISAM table, it would be great if someone could confirm or deny this.

Re: foreign key creation on MyISAM storage engine

2006-03-28 Thread Martijn Tonies
Hello Taco, I previously tried this same question on the GUI tool list, but not much traffic there, so I thought I'd give it a go here. I've been reading some articles that suggest I should be able to create a relationship on a MyISAM table, it would be great if someone could confirm or deny

Re: foreign key creation on MyISAM storage engine

2006-03-28 Thread Greg 'groggy' Lehey
, this is true - you can create columns with values that point to other tables. What you probably are asking, is if you can referential integrity constraints. The answer, for MyISAM tables, is NO. Currently foreign key constraints only work for InnoDB tables. We're working making foreign keys table

SQL Foreign Key

2006-03-12 Thread Andreas Krüger
. (that is trying to be used to establish the FOREIGN KEY definitions) Here is the output of the mysql client: mysql SHOW CREATE TABLE friends\G *** 1. row *** Table: friends Create Table: CREATE TABLE `friends` ( `id` smallint(5) unsigned NOT NULL

Re: SQL Foreign Key

2006-03-12 Thread Martijn Tonies
Hello Andreas, You're not telling us what version of MySQL you're using, so I'll have to give it a shot in the dark ... mysql SHOW CREATE TABLE friends\G *** 1. row *** Table: friends Create Table: CREATE TABLE `friends` ( `id`

SQL Foreign Key

2006-03-12 Thread Andreas Krüger
(5) unsigned NOT NULL, * KEY `idx` (`idx`), KEY `id` (`id`), CONSTRAINT `relation_ibfk_1` FOREIGN KEY (`idx`) REFERENCES `friends` (`id`), CONSTRAINT `relation_ibfk_2` FOREIGN KEY (`id`) REFERENCES `friends` (`id`) *) *ENGINE=InnoDB* DEFAULT CHARSET=latin1 1 row in set (0.00 sec) Defining

Re: SQL Foreign Key

2006-03-12 Thread Michael Stassen
failing instruction: *mysql SHOW INNODB STATUS;* ... LATEST FOREIGN KEY ERROR 060312 13:40:40 Transaction: TRANSACTION 0 7440, ACTIVE 0 sec, OS thread id 3048 inserting, thread declared nside InnoDB 499 mysql tables in use 2, locked 2 6 lock struct(s

Re: SQL Foreign Key

2006-03-12 Thread Andreas Krüger
Thanks Michael, that' s the problem. Syntactically my attempt was correct. Only I had the *value '1' in the only row that table `friends`contains, whereas table `category`was still empty*. (I was about creating the database for sample purposes.) When I tried to create the FOREIGN KEY out

Can't Create Foreign Key Constraints

2006-02-07 Thread Lola J. Lee Beno
I'm trying to create foreign key constraints and keep getting an error message 1005 (I did look it up, but didn't see an obvious solution to fixing this for my database). The version I'm using is 5.0.17-max. I used Mysql WorkBench to create the database schema and had it generate the sql

Re: Can't Create Foreign Key Constraints

2006-02-07 Thread Michael Stassen
Lola J. Lee Beno wrote: I'm trying to create foreign key constraints and keep getting an error message 1005 (I did look it up, but didn't see an obvious solution to fixing this for my database). The version I'm using is 5.0.17-max. I used Mysql WorkBench to create the database schema

Re: Can't Create Foreign Key Constraints

2006-02-07 Thread Lola J. Lee Beno
Michael Stassen wrote: 1) I'm not sure what you are intending with (`(not null)`) in the middle of your foreign key definition, but that isn't valid mysql syntax. See the manual for the correct syntax http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html. This is from

Re: Can't Create Foreign Key Constraints

2006-02-07 Thread Peter Brawley
` DATETIME NULL,   PRIMARY KEY (`FilmID`),   CONSTRAINT `FK_RatingID` FOREIGN KEY `RatingID` (`(not null)`)     REFERENCES `ows`.`FilmsRatings` (`RatingID`)     ON DELETE CASCADE     ON UPDATE CASCADE ) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; And got

Re: Can't Create Foreign Key Constraints

2006-02-07 Thread Lola J. Lee Beno
Peter Brawley wrote: Lola, /And got this following error message: ERROR 1072 (42000): Key column '(not null)' doesn't exist in table / Yes, it's telling you what;s wrong: to define a constraint on a key, the table def must first define the key. Looking over the script again, RatingID is

Re: Can't Create Foreign Key Constraints

2006-02-07 Thread Gleb Paharenko
` LONGTEXT NULL, `ImageName` VARCHAR(50) NULL, `DateInTheaters` DATETIME NULL, PRIMARY KEY (`FilmID`), CONSTRAINT `FK_RatingID` FOREIGN KEY `RatingID` (RatingID) REFERENCES `FilmsRatings` (`RatingID`) ON DELETE CASCADE ON UPDATE

Re: Can't Create Foreign Key Constraints

2006-02-07 Thread Lola J. Lee Beno
Gleb Paharenko wrote: Hello. The query which is works is: Thanks - just what I needed. Looks like I'll need to be extra careful with sql scripts generated from Mysql Workbench, which is still alpha right now. -- Lola - mailto:[EMAIL PROTECTED] http://www.lolajl.net | Blog at

Re: Can't Create Foreign Key Constraints

2006-02-07 Thread Gleb Paharenko
Hello. You can post a bug: http://dev.mysql.com/doc/refman/5.0/en/bug-reports.html Lola J. Lee Beno wrote: Gleb Paharenko wrote: Hello. The query which is works is: Thanks - just what I needed. Looks like I'll need to be extra careful with sql scripts generated from Mysql

Re: MySQL ignores foreign key relationships between tables?

2006-01-31 Thread Ferindo Middleton Jr
using InnoDB. I use MySQL Administrator and InnoDB is what it says all my tables are already using so it must have chosen that by default or something. Does this mean that I shouldn't have been able to delete records from my schedules table above that had a foreign key in the registration table

Re: MySQL ignores foreign key relationships between tables?

2006-01-30 Thread Ferindo Middleton Jr
tables are already using so it must have chosen that by default or something. Does this mean that I shouldn't have been able to delete records from my schedules table above that had a foreign key in the registration table? Thanks. Ferindo Paul, I discovered that this foreign key constraint

Re: MySQL ignores foreign key relationships between tables?

2006-01-30 Thread Paul DuBois
Administrator and InnoDB is what it says all my tables are already using so it must have chosen that by default or something. Does this mean that I shouldn't have been able to delete records from my schedules table above that had a foreign key in the registration table? Thanks. Ferindo Paul

Re: MySQL ignores foreign key relationships between tables?

2006-01-29 Thread Ferindo Middleton Jr
. Does this mean that I shouldn't have been able to delete records from my schedules table above that had a foreign key in the registration table? Thanks. Ferindo Paul, I discovered that this foreign key constraint wasn't present in these tables anymore due to my own action. You see, I had

Re: MySQL ignores foreign key relationships between tables?

2006-01-29 Thread Paul DuBois
so it must have chosen that by default or something. Does this mean that I shouldn't have been able to delete records from my schedules table above that had a foreign key in the registration table? Thanks. Ferindo Paul, I discovered that this foreign key constraint wasn't present

MySQL ignores foreign key relationships between tables?

2006-01-28 Thread Ferindo Middleton Jr
I have two tables, registration schedules, that look like this: CREATE TABLE registration ( idSERIAL NOT NULL UNIQUE, firstnameVARCHAR(256) NOT NULL, middlenameTEXT,

Re: MySQL ignores foreign key relationships between tables?

2006-01-28 Thread Paul DuBois
At 17:56 -0500 1/28/06, Ferindo Middleton Jr wrote: I have two tables, registration schedules, that look like this: CREATE TABLE registration ( idSERIAL NOT NULL UNIQUE, firstnameVARCHAR(256) NOT NULL,

Re: MySQL ignores foreign key relationships between tables?

2006-01-28 Thread Ferindo Middleton Jr
records from my schedules table above that had a foreign key in the registration table? Thanks. Ferindo -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: MySQL ignores foreign key relationships between tables?

2006-01-28 Thread Ferindo Middleton Jr
shouldn't have been able to delete records from my schedules table above that had a foreign key in the registration table? Thanks. Ferindo Paul, I discovered that this foreign key constraint wasn't present in these tables anymore due to my own action. You see, I had backed up my database before

Re: Foreign Key with constant?

2005-12-27 Thread Danny Stolle
Hi jesse, You can only set the reference in your constraint: ... ADD FOREIGN KEY (id) references table(id) ... In this case you will get an inconsistent database. Dont reference the two tables Campers and Counselers with the ActivitySelections table, but use two tables in which you put

Re: Foreign Key with constant?

2005-12-27 Thread Jesse
, December 27, 2005 6:27 AM Subject: Re: Foreign Key with constant? Hi jesse, You can only set the reference in your constraint: ... ADD FOREIGN KEY (id) references table(id) ... In this case you will get an inconsistent database. Dont reference the two tables Campers and Counselers

Foreign Key with constant?

2005-12-26 Thread Jesse
I need to be able to add a foreign key that will allow a constant is possible. I have a table named Campers that has a field named ID. I also have another table called Counselors that has a field named ID as well. There is a detailed table called ActivitySelections that I use for both

Foreign Key Help

2005-12-22 Thread Jesse
I am trying to add referential integrity to my database. I'm trying to add a foreign key reference to one of my tables, but I'm getting an error when I try to do so. Here's what I'm executing: ALTER TABLE Campers ADD CONSTRAINT FK_Activities FOREIGN KEY FK_Activities (ID) REFERENCES

Re: Foreign Key Help

2005-12-22 Thread SGreen
Jesse [EMAIL PROTECTED] wrote on 12/22/2005 02:51:21 PM: I am trying to add referential integrity to my database. I'm trying to add a foreign key reference to one of my tables, but I'm getting an error when I try to do so. Here's what I'm executing: ALTER TABLE Campers ADD CONSTRAINT

Re: Foreign Key Help

2005-12-22 Thread Jesse
] To: Jesse Cc: mysql@lists.mysql.com Sent: Thursday, December 22, 2005 3:00 PM Subject: Re: Foreign Key Help Jesse [EMAIL PROTECTED] wrote on 12/22/2005 02:51:21 PM: I am trying to add referential integrity to my database. I'm trying to add a foreign key reference to one of my

Re: weird innodb foreign key feature

2005-10-27 Thread Ady Wicaksono
I see, Thanks for information, yes correct this NO ACTION is confusing me. BTW, congratulation for your new email @oracle.com :D Heikki Tuuri wrote: Ady, NO ACTION actually means the same as RESTRICT. That is, the foreign key constraint is still enforced. The name 'NO ACTION' is from

weird innodb foreign key feature

2005-10-26 Thread Ady Wicaksono
','FALSE') default 'FALSE', `push_operator` varchar(30) NOT NULL default '', `push_unsubscribe_reason` text NOT NULL, PRIMARY KEY (`push_member_id`), KEY `t_push_member_unsub_ibfk_1` (`push_keycode`), CONSTRAINT `t_push_member_unsub_ibfk_1` FOREIGN KEY (`push_keycode`) REFERENCES `t_keycode

Re: weird innodb foreign key feature

2005-10-26 Thread Heikki Tuuri
Ady, NO ACTION actually means the same as RESTRICT. That is, the foreign key constraint is still enforced. The name 'NO ACTION' is from the SQL standard. I agree that the name is confusing, but I cannot help it, because it is in the standard. Regards, Heikki Oracle/Innobase - Original

Re: compound foreign key(s)

2005-10-15 Thread Gleb Paharenko
` as PK I want to have a 3rd innoDb table: countrylang with `cid,lang` as compound key with both `cid` and `lang` as foreign (cascade-delete) keys to the master tables. However mysql throws error (Cannot create table..) when I try to define `cid` as a foreign key to country.id

compound foreign key(s)

2005-10-13 Thread Guy Brom
..) when I try to define `cid` as a foreign key to country.id country.id and countrytext.cid are both smallint(5) Any help? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: compound foreign key(s)

2005-10-13 Thread Ady Wicaksono
Hi Guy, Use SHOW INNODB STATUS and check foreign key error at there Good luck Guy Brom wrote: I have the following innoDb tables: country has `id` as PK lang has `id` as PK I want to have a 3rd innoDb table: countrylang with `cid,lang` as compound key with both `cid` and `lang` as foreign

Problems with creating of foreign key

2005-10-12 Thread Tatjana Cukic
hello, does anybody knows the error: can't create table '.\Cherry\#sql-288_5d.frm' (errno:150) it happens when i try to create foreign keys in Table1, and that foreign key is actually primary key in Table2 (to which i relate my foreign key) Thanx a lot! Tatjana

Re: Problems with creating of foreign key

2005-10-12 Thread SGreen
Tatjana Cukic [EMAIL PROTECTED] wrote on 10/12/2005 12:28:47 PM: hello, does anybody knows the error: can't create table '.\Cherry\#sql-288_5d.frm' (errno:150) it happens when i try to create foreign keys in Table1, and that foreign key is actually primary key in Table2 (to which i

Re: Foreign key support in MyISAM

2005-09-30 Thread Jacek Becla
Hi, I had asked similar question few days ago, and then checked with the developers as no one was able to answer on this mailing list. I was told it is very likely we'll get it in 5.2. Jacek Sujay Koduri wrote: does anyone have an idea when mysql guys are going to include foreign key

<    1   2   3   4   5   6   7   >