[Gambas-user] [slightly OT] No Problem with Gambas or MySql!
Fernando Martins
fernando at ...3175...
Sun Oct 6 11:00:43 CEST 2013
On 10/06/2013 02:25 AM, Bruce wrote:
> postgres, because it properly supports "ON UPDATE CASCADE" constraints
> on those tables and their foreign key columns handles it all
> internally. Anyway, as I said, [ASIDE] and just one of the reasons for
> preferring postgresql.
In my experience it's not a good idea to use a semantic field (horse
name, or even chip id) as the choice of primary key. It has some
advantages to do so but the trouble one gets doesn't pay off. For
instance, your cascade update does not handle the case where you have
views that use the primary key in the criteria, e.g.,
SELECT results FROM Races
WHERE name='Lemon Liniment'
Using a auto inc pkey that is never exposed to the user is, IMO, a
better option. It's a subjective opinion, though, no ned to argue. That
does not mean I always use autoinc. In the case of composite pkeys, as
long as all the fields involved are semantic-less, usually I don't add
an artificial autoinc pkey.
Sorry for the OT posting, I'll stop.
More information about the User
mailing list