According to this post the following SQL statements should give me a vector
1, 2, 2, 2, 2 in the end:
You're inserting NULL values into the Primary Key column. Since you can't have two rows with the same PK, you're probably not actually inserting any real data (which is also probably an error you want to catch). Try:
dbSendQuery(con, "INSERT INTO t VALUES(5);")
Executing that should give you two different values for last_insert_id.
Edit: misunderstood. See here for the details on LAST_INSERT_ID. Revised answer: if you don't specify a value in an AUTO_INCREMENT column, then you should get a LAST_INSERT_ID value returned. In that case, try:
INSERT INTO t DEFAULT VALUES