Tim Soderstrom wrote:
Actually, I'm the opposite. I like having specific types for this. It
makes is abundantly clear and well defined by calling it something other
than an integer. Yes, at least in this case, it's an integer, but that
doesn't mean you should add it to other integers, like Salary, or
something. It seems like if you use a modifier to an integer, all that
becomes less clear. Plus, if Drizzle uses custom types for this, it
would make more sense if other people wanted to make their own sequence
types.
Hi Tim,
I agree that this is not an "arithmetic" integer. But this goes for any
integer that is used for identification purposes - the type apparatus of
SQL does not prevent you from doing strange things to account numbers,
zip codes, etc.
Another issue is if you use auto-generated values as part of referential
integrity constraints. Say that you have an auto-generated order number.
Then you want order lines consisting of order number and line number,
with a foreign key reference from the order to the order line. In this
case, I think that it is a good thing to have the same data type
specification for both order number columns, even though one of them is
auto-generated and the other is not.
Of course, having user-defined domains and perhaps also restrictions on
allowed operations could have been useful here...
Thanks,
Roy
$0.02
Tim
On Feb 5, 2009, at 2:25 AM, Roy Lyseng wrote:
Hi,
I like the idea of having these data types being regular data types
(like Integer, Decimal, Byte string or whatever), and having certain
system-enforced properties (ie auto-increment and/or auto-identity).
Auto-increment would mean that the system assigns a number that is
guaranteed to be assigned increasing numbers, with or without gaps
(maybe controlled by a NOGAPS property?). Auto-increment would
probably also imply that the column is read-only (no UPDATE allowed).
Auto-identity guarantees uniqueness, but not necessarily increasing
order. This would be more useful for distributed engines where each
engine instance can assigns values from a dedicated range.
Thus, the integer type with auto-identity or auto-increment would have
the same type compatibility properties as any other integer. You may
also assign the desired precision for your application (e.g
decimal(15,0)).
Regards,
Roy
Arjen Lentz wrote:
Hi Jay
On 05/02/2009, at 12:31 PM, Jay Pipes wrote:
On a practical note, the naming of both "auto-increment" and
"sequence" is unfortunate, because it causes implicit expectations
on the behaviour. UNIQUE_ID or GENERATOR (thank Jim!) would be
clearer, it's just intended to provide a unique ID, and nothing else.
And while in principle I can see how having it user-definable in
terms of logic can be useful, I don't think it's essential.
In SQL Server, it's called IDENTITY, which I think is a fine name.
So is generator and UNIQUE_ID. I agree with all that
auto-increments *implied* always-incrementing behaviour is not good.
IDENTITY sounds very good. Of course we'd need to look at how it
behaves for MSSQL, because if Drizzle's implementation is
particularly different, it could confuse with having the same name.
Might learn something too.
Cheers,
Arjen.
--Arjen Lentz, Director @ Open Query (http://openquery.com.au)
MySQL Training from $475/day, DBA/Support from $249/month
My blog is at http://arjen-lentz.livejournal.com
OurDelta: free enhanced builds for MySQL @ http://ourdelta.org
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp