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.

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to