|
Posted by Toby A Inkster on 03/31/07 21:04
Erwin Moller wrote:
> Consider this example:
> 1) Your tbluser as described above by you.
> 2) a collection of articles written by that user
>
> CREATE TABLE tblarticle(
> articleid serial PRIMARY KEY,
> writtenby login REFERENCES tbluser(login),
> content VARCHAR(10000)
> )
>
> I made a FK as you see.
> Now what happens if that user wants a new loginname?
>
> You are forced to update this new loginname everwhere in your database where
> you use it.
> Or do you use cascading?
> (I dislike cascading though all FK constraints, but it is of course
> possible)
I do indeed use cascading. But I'd be tempted not to allow users to change
login anyway, as it would probably result in URL changes, which I try to
avoid as much as possible.
> What happened to good old nextval()?
This particular project aims at supporting PostgreSQL, MySQL, Firebird, MS
SQL Server and Oracle. PostgreSQL sequences are nice, but
PostgreSQL-specific.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
[Back to original message]
|