The drop is always movingYou know that saying about standing on the shoulders of giants? Drupal is standing on a huge pile of midgetsAll content management systems suck, Drupal just happens to suck less.Popular open source software is more secure than unpopular open source software, because insecure software becomes unpopular fast. [That doesn't happen for proprietary software.]Drupal makes sandwiches happen.There is a module for that

Drupal 7 core developers are ... - not conclusive

Submitted by nk on Sat, 2012-09-15 05:42

I can't let the Drupal 7 User IDs - Not Consecutive post alone just like that. A couple of emphasized "they" referring to some core contributors is really deeply disturbing because it furthers a false argument: there are "core developers" and there are "others". Everyone can write core patches and you are more than welcome to! As for this issue, it's not about liking or disliking auto-increment, it's about real problems with auto-increment, one of the biggest is not even listed because it's implied to be known: in D6 the presence of a 0 in an autoincrement column (the user id) causing massive import headaches. Oh and please don't use the "solution" in that blog post, it has a lot of race conditions... and why I didn't comment there? Because comments are Facebook only and I don't use Facebook.

Disclaimer: I wrote the patch in question. This has nothing to do with the problem outlined above.

Commenting on this Story is closed.

Submitted by Anonymous on Sat, 2012-09-15 07:07.

Why is a lack of consecutive ids an issue? Neatness?

Unless there is a concrete requirement (contractual, legal, regulatory), to me this is a total non-issue.

Submitted by Anonymous on Sat, 2012-09-15 16:16.

I can't understand the need for being parsimonious about UIDs. Maybe he thinks if they're not consecutive, he'll run out?

Submitted by Anonymous on Sat, 2012-09-15 08:40.

Also didn't comment for the same reason.

Submitted by Anonymous on Sat, 2012-09-15 13:22.

so how other system implement it? and why Drupal don't do it in same way

Submitted by Anonymous on Sat, 2012-09-15 14:38.

I'd rather see big ugly uuids anyway.

Submitted by Anonymous on Sat, 2012-09-15 16:41.

only care that the numbers are unique, not consecutive. If you really want to figure out who came first then use a date time stamp.

Submitted by Anonymous on Sat, 2012-09-15 18:17.

You hit the nail on the head, that blog post bothered me too.

Of course one is free to run a Drupal site however they see fit, but the posted code is dangerous and should never be used. Under any kind of load you'll quickly get duplicate ID's generated and your database will return errors when that happens.

Also couldn't comment there because of the authentication system.

Submitted by Anonymous on Mon, 2012-09-17 15:53.

I really don't understand the fuss about this. If there's a problem with consecutive IDs, then ditch them. Who cares? Most content have aliases anyway! This is a total nitpick and I for one couldn't care less if IDs are consecutive or not...

Submitted by Anonymous on Mon, 2012-09-17 19:53.

I want to stand up for consecutive UIDs. I have no technical reason and so I don't expect it to have any influence on how core works but I can at least have my $.02. I have my UID memorized and I can get a rough idea of how long someone has been around from their UID. No, it doesn't matter, really. Having a low UID doesn't make you better than anyone else. But I find it interesting none-the-less. And, yes, I realize that the UIDs are still incrementing even if not sequentially so, but jumping from UID 100 to UID 5042 and then to UID 10768 does ruin the whole aesthetic. :)

It's also kind of handy to get a sense of how many users a site has by seeing how high the UIDs go. Again, not a perfect solution (spammers are included, etc) but can be useful.

Obviously, feelings and aesthetics don't counteract real technical problems. I'm not fighting to change them back because I'm certainly not volunteering to write the patch to make them work. ;) But I hate to see them dismissed as useless because they aren't important to everyone. To some, sequential ideas are important. I think we can say, sorry, it's not technically possible, without rolling our eyes and dismissing the issue as unimportant.


Submitted by Anonymous on Mon, 2012-09-17 19:54.

Gah... "sequential UIDs" not "sequential ideas"...

Submitted by Dave Cohen on Tue, 2012-09-18 18:41.

Károly, This is Dave, who posted the thread you're addressing.

My original post was intended to be snarky. I didn't write it well enough. I'm sorry for offending you or anyone else. I meant irony in the word they, as if there were a they out there when my audience would understand it is really all of us. Seriously, I didn't mean you. I now see how because I refer to an issue by you, it could be interpreted that way.

I meant to express frustration at this change to D7 that I only just learned about. You talk about real problems with auto-increment as if we all know all about them. I personally was, obviously, unaware. When I saw the users table skipping IDs, I thought a bug needed to be tracked down.

I'm surprised to read, "this has nothing to do with the problem outlined above," because you use the word problem. I expected your position to be that there is no problem to solve. I get the impression, from the issue on d.o, and from prior comments here, that only a fool would want/expect IDs the way I do. It's that impression that makes me write snarky posts to Planet Drupal.

So, I want consecutive IDs. Some people ask why? I say, who cares why? It's my itch and I want to scratch it. I don't want to be told my itch is not good enough for Drupal. I want Drupal to be so flexible that everyone's itches can be scratched.

As for my code, it's been updated since you first read it. It's still not pretty, IMHO because Drupal provides no clean way to scratch this particular itch. I think that's a shame. I think Drupal gets a little worse with each change that even a motivated coder cannot work around. That's what my original post was supposed to be about.


Submitted by nk on Thu, 2012-09-20 02:12.

The problem as I meant it is a post on Drupal Planet which furthers the often heard and very wrong division between core developers and the rest. The problem is that you form an "opinion" on a technical problem. There are no opinions on that. It's a technical problem. I can have an opinion whether I like broccoli or not (my particular opinion on that "it's complicated"...) If your "opinion" is such that the solution we came up with does not cover your needs, open a followup. For example, having a sequences table for most needs and a specific for the users table might be an adequate solution. I bet this could be patched in a BC way so it can get into D7. Go, file an issue. If you come to IRC, as one of the DBTNG maintainers (and the guy who wrote the current one) I will help you the same as I am helping everyone else working on core. In general, creating a sequences table per table would be a solution. David talked about in a comment. Reading it now makes me wonder whether it's really so that we would need to create sequence on-the-fly. If you open a new issue to explore this problem then contact David and politely ask him to elaborate on this there.

Ps. add an optional argument to db_next_id, nextId, add an if db_table_exists('sequences_' . $table to DatabaseConnection_mysql::nextId and change the sequences table name into a variable. You will have some challenges with the shutdown function to pass the right table name into it. Perhaps a static property on the Database class storing the table names to be cleaned up?

Submitted by Anonymous on Sat, 2012-12-29 10:04.

If you really want to figure out who came first then use a date time stamp.