Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should be much more hesitant to use the datetime as a primary key anyway because of the wild and wooly world of timezones, leapseconds, and lots of other things that will surprise you. There is absolutely no guarantee that <code>a1 = datetime('now')</code> is always less than or equal to the next invocation of <code>a2 = datetime('now')</code></p> <p>Read this article, about 1/3 the way down he starts talking about dates, times, and timezones. This should convince you that you should not be trying to do what you are asking for in this question:</p> <p><a href="https://msmvps.com/blogs/jon_skeet/archive/2009/11/02/omg-ponies-aka-humanity-epic-fail.aspx" rel="nofollow">https://msmvps.com/blogs/jon_skeet/archive/2009/11/02/omg-ponies-aka-humanity-epic-fail.aspx</a></p> <p>If I wanted a quick and dirty hack work around, I would put the insert into a while loop and catch the error when the insert failed, and then try again 1 millisecond later. This is bad, and is like leaving a huge mess in the bedroom, but sometimes it is necessary because redesigning the table to have a sensible primary key would take too long.</p> <p>However, if you do this, be prepared for the code to be sitting in that while loop, trying and waiting patiently for tens of milliseconds, and when it finally does find an open slot, it doesn't do what you expect because it appears BEFORE another entry that occurred in the future (which was actually in the past). Thinking about that makes my head hurt. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload