If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How to create a foreign key to a table from metaschema ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-07-11, 02:39
boraldo boraldo is offline
Registered User
 
Join Date: Jan 2011
Posts: 5
How to create a foreign key to a table from metaschema ?

I want to create tables that will keep some additional data on schemas and tables. And I need referential integrity. So my tables must link to tables from schema information_schema.
The trouble is that those tables are not real tables but views. So usual foreign key cannot be created.

Example. My table schemas must link to table information_schema.SCHEMATA.

What can you propose ?
Reply With Quote
  #2 (permalink)  
Old 01-07-11, 05:28
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,535
Quote:
Originally Posted by boraldo View Post
What can you propose ?
you can carry on without the foreign keys, yes?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-08-11, 07:45
boraldo boraldo is offline
Registered User
 
Join Date: Jan 2011
Posts: 5
Quote:
Originally Posted by r937 View Post
you can carry on without the foreign keys, yes?
No, without referential integrity system becomes weak.
I search for ways to store information about schemes and tables in some way that keeps referential integrity.
Reply With Quote
  #4 (permalink)  
Old 01-08-11, 09:01
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,535
Quote:
Originally Posted by boraldo View Post
No, without referential integrity system becomes weak.
it's funny, isn't it, that millions of other mysql customers are happy with the referential integrity provided by the software right out of the box, and you feel you need to supplement it somehow...
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-08-11, 13:40
boraldo boraldo is offline
Registered User
 
Join Date: Jan 2011
Posts: 5
Quote:
Originally Posted by r937 View Post
it's funny, isn't it, that millions of other mysql customers are happy with the referential integrity provided by the software right out of the box, and you feel you need to supplement it somehow...
I suppose those millions don't need to store metadata about tables.
Reply With Quote
  #6 (permalink)  
Old 01-08-11, 14:18
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,535
yeah, that was my point

you should go ahead and store your metadata if you need to -- nothing wrong with that

that's why i said "you can carry on without the foreign keys, yes?"

i'm not suggesting you do away with foreign keys in your regular database, just none between your metadata and the information_schema tables
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On