Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    3

    Unanswered: postgre or mysql for foreign keys

    Hi all, I am hoping you can give me some insight.
    I am very new to working with databases. I have taken courses, read some books, and am now ready to start developing some databases for web pages.

    My question is this:
    I was always taught that to maintain referential integrity, and other reasons, in a complex database, foreign keys were recommended.

    I have planned a database design with foreign keys, and now i fine (apparently?) that mysql cannot use foreign keys, unless compiled a certain way, etc...
    My question is this: Is postgres better for foreign key implementation?

  2. #2
    Join Date
    Jan 2003
    Location
    Duncan BC Canada
    Posts
    80
    Yes, PostGreSQL is generally better for this. MySQL can be made to enforce foreign key constraints, but not easily. You have to be careful to set it up correctly (InnoDB tables, etc).

    I had a problem particular to the Windows version where inserting data in a child table would put the entry in as '' (empty string) if it was the wrong datatype, even though there was a foreign key constraint on it. You CAN work around it, just make sure that you test the heck out of it (which you should do on any platform anyway).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •