No more Blub for me, thank you, Vicar.
chris webster wrote:Netbeans is trying to save you from yourself.
chris webster wrote:
The point of a primary key is that you can rely on it to uniquely identify a particular record
chris webster wrote:
and it should be stable because the PK is used in foreign keys from related tables as well, so it's a lot easier to maintain these relationships if you don't keep changing the PK. That's why many DBs will stop you changing the PK column values.
chris webster wrote:
If you think you may have to change a primary key, then it probably isn't your primary key at all (although it may still be a unique key which you can define separately from the PK), so you should possibly consider using a surrogate key (a numeric ID) as your PK instead.
chris webster wrote:
The key.
The whole key.
And nothing but the key.
So help me Codd.
No more Blub for me, thank you, Vicar.
Tom Tomm wrote:
chris webster wrote:
The point of a primary key is that you can rely on it to uniquely identify a particular record
That's why the primary key in my table is a combo of 2 fields. Not just one. And I do want to be able to change homerUrl field, because websites sometimes move to different adress, so being able to change stuff would be nice.
chris webster wrote:
If you think you may have to change a primary key, then it probably isn't your primary key at all (although it may still be a unique key which you can define separately from the PK), so you should possibly consider using a surrogate key (a numeric ID) as your PK instead.
Adding something that is artificial and completly useless is: 1. Bad programming practice 2. Even worse programming practice 3.The homeUrl is being used in various other tables as a foreign key, so doing smth like: delete the row, insert new one won't work, because of the cascade effects it has. And sinnce MySQL itself does support updating primary key and if MySQL itself thinks it's ok, then who is Netbeans to judge it.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
No more Blub for me, thank you, Vicar.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |