{"id":2250,"date":"2011-01-06T14:08:58","date_gmt":"2011-01-06T04:08:58","guid":{"rendered":"http:\/\/www.flamingspork.com\/blog\/?p=2250"},"modified":"2014-10-08T09:16:08","modified_gmt":"2014-10-07T23:16:08","slug":"no-implicit-commit-on-the-road-to-transactional-ddl","status":"publish","type":"post","link":"https:\/\/www.flamingspork.com\/blog\/2011\/01\/06\/no-implicit-commit-on-the-road-to-transactional-ddl\/","title":{"rendered":"No implicit commit (on the road to transactional DDL)"},"content":{"rendered":"<p>A long time ago, in a time that can only serve to make some feel old and others older, MySQL didn&#8217;t support transactions. Each statement was executed as it went, there was no ROLLBACK (or COMMIT or crash recovery etc). Then there were transactions. Other RDBMSs implement auto_commit functionality, but for MySQL users, we think of it as the magic compatibility mode that (mostly) makes applications written for MyISAM magically work on InnoDB (okay, and making &#8220;you should use transactions&#8221; a really easy consulting gig :)<\/p>\n<p>I&#8217;m currently working on finishing up a patch that removes the implicit COMMIT from DDL operations in <a href=\"http:\/\/www.drizzle.org\">Drizzle<\/a>. Instead, you get an error message saying that Transactional DDL is not currently supported. I see a future where we have one of two situations (possibly depending on the storage engine): support DDL within normal transactions, DDL only transactions (cannot mix with DML). The latter (DDL only transactions) I see as the option for InnoDB\/HailDB.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A long time ago, in a time that can only serve to make some feel old and others older, MySQL didn&#8217;t support transactions. Each statement was executed as it went, there was no ROLLBACK (or COMMIT or crash recovery etc). &hellip; <a href=\"https:\/\/www.flamingspork.com\/blog\/2011\/01\/06\/no-implicit-commit-on-the-road-to-transactional-ddl\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[76,75,14],"tags":[269,70,395],"class_list":["post-2250","post","type-post","status-publish","format-standard","hentry","category-code","category-drizzle-work-et-al","category-mysql","tag-ddl","tag-drizzle","tag-transactions"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5a6n8-Ai","jetpack-related-posts":[{"id":2168,"url":"https:\/\/www.flamingspork.com\/blog\/2010\/10\/25\/storage-engine-api-state-graph\/","url_meta":{"origin":2250,"position":0},"title":"Storage Engine API state graph","author":"Stewart Smith","date":"2010-10-25","format":false,"excerpt":"Drizzle still has a number of quirks inherited from the MySQL Storage Engine API (e.g. BLOBs, row buffer, CREATE SELECT and lack of DDL transaction boundaries, key tuple format). One of the things we fixed a long time ago was to have proper methods for StorageEngines to be called for:\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"State transitions for a transaction. Transaction can be empty OR have one or more statements","src":"https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2010\/10\/edge30-300x163.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1903,"url":"https:\/\/www.flamingspork.com\/blog\/2010\/04\/21\/storage-engine-api-write_row-create-select-and-ddl\/","url_meta":{"origin":2250,"position":1},"title":"Storage Engine API: write_row, CREATE SELECT and DDL","author":"Stewart Smith","date":"2010-04-21","format":false,"excerpt":"(this probably applies exactly the same for MySQL and Drizzle... but I'm just speaking about current Drizzle here) In my current merge request for the embedded-innodb\u00ef\u00bb\u00bf-create-select-transaction-arrgh branch (also see this specific revision), you'll notice an odd hoop that we have to jump through to make CREATE SELECT statements work with\u2026","rel":"","context":"In &quot;drizzle&quot;","block_context":{"text":"drizzle","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/drizzle-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2313,"url":"https:\/\/www.flamingspork.com\/blog\/2011\/03\/03\/undocumented-alter-table-that-does-nothing\/","url_meta":{"origin":2250,"position":2},"title":"Undocumented ALTER TABLE that does *nothing* (useful)","author":"Stewart Smith","date":"2011-03-03","format":false,"excerpt":"(at least since MySQL 5.1.42) alter table t1 force; Pretty neat huh? In fact, in Drizzle this will end up doing a copying alter table. Not useful. There's an over four year old bug report in MySQL (Bug#24091). I'm just going to remove that bit from the parser in Drizzle\u2026","rel":"","context":"In &quot;drizzle&quot;","block_context":{"text":"drizzle","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/drizzle-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1251,"url":"https:\/\/www.flamingspork.com\/blog\/2008\/11\/06\/goodbye-frm-or-at-least-the-steps-to-it\/","url_meta":{"origin":2250,"position":3},"title":"Goodbye FRM (or at least the steps to it)","author":"Stewart Smith","date":"2008-11-06","format":false,"excerpt":"Since before MySQL was MySQL, there has been the .FRM file. Of course, what it really wanted to be was \".form\" -\u00c2\u00a0 a file that stored how to display a form on your (green) CRT. Jan blogged earlier in the year on this still being there, even in MySQL 5.1\u2026","rel":"","context":"In &quot;drizzle&quot;","block_context":{"text":"drizzle","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/drizzle-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2310,"url":"https:\/\/www.flamingspork.com\/blog\/2011\/03\/03\/sql-oddity-alter-table-and-default-values\/","url_meta":{"origin":2250,"position":4},"title":"SQL Oddity: ALTER TABLE and default values","author":"Stewart Smith","date":"2011-03-03","format":false,"excerpt":"\u00ef\u00bb\u00bfSo, the MySQL (and Drizzle) ALTER TABLE syntax allows you to easily change the default value of a column. For example: CREATE TABLE t1 (answer int); ALTER TABLE t1 ALTER answer SET DEFAULT 42; So, you create a TIMESTAMP column and forgot to set the default value to CURRENT_TIMESTAMP. Easy,\u2026","rel":"","context":"In &quot;drizzle&quot;","block_context":{"text":"drizzle","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/drizzle-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2307,"url":"https:\/\/www.flamingspork.com\/blog\/2011\/03\/01\/alter-table-rename-rename-rename\/","url_meta":{"origin":2250,"position":5},"title":"ALTER TABLE RENAME RENAME RENAME","author":"Stewart Smith","date":"2011-03-01","format":false,"excerpt":"Here's a nice challenge for you. What does the following do (or error out on?): CREATE TABLE t1 (a int); CREATE TABLE t2 (b int); ALTER TABLE t1 RENAME t3, RENAME t2, RENAME t4; I'd be interested to know what a) you think it does and then b) if you\u2026","rel":"","context":"In &quot;drizzle&quot;","block_context":{"text":"drizzle","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/drizzle-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/2250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/comments?post=2250"}],"version-history":[{"count":3,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/2250\/revisions"}],"predecessor-version":[{"id":3846,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/2250\/revisions\/3846"}],"wp:attachment":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/media?parent=2250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/categories?post=2250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/tags?post=2250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}