Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-20741

Inserted row missing after commit

    XMLWordPrintable

    Details

      Description

      After beginning a transaction, inserting into two tables with the second using last_insert_id, both say query ok, 1 row affected, then committing, the row is missing from the first table.

      statements:
      START TRANSACTION;
      INSERT INTO `m_quote` (`store_id`, `is_virtual`, `is_multi_shipping`, `items_count`, `items_qty`, `base_currency_code`, `store_currency_code`, `quote_currency_code`, `grand_total`, `base_grand_total`, `customer_id`, `customer_tax_class_id`, `remote_ip`, `applied_rule_ids`, `global_currency_code`, `base_to_global_rate`, `base_to_quote_rate`, `subtotal`, `base_subtotal`, `subtotal_with_discount`, `base_subtotal_with_discount`, `is_changed`) VALUES ('1', '0', '0', '1', '1', 'USD', 'USD', 'USD', '25.95', '25.95', NULL, '3', '207.98.208.180', NULL, 'USD', '1', '1', '25.95', '25.95', '25.95', '25.95', '1');
      INSERT INTO `m_quote_address` (`quote_id`, `customer_id`, `save_in_address_book`, `address_type`, `email`, `region_id`, `same_as_billing`, `subtotal`, `base_subtotal`, `tax_amount`, `base_tax_amount`, `shipping_amount`, `base_shipping_amount`, `shipping_tax_amount`, `base_shipping_tax_amount`, `discount_amount`, `base_discount_amount`, `grand_total`, `base_grand_total`, `applied_taxes`, `subtotal_incl_tax`, `discount_tax_compensation_amount`, `base_discount_tax_compensation_amount`, `shipping_discount_tax_compensation_amount`, `shipping_incl_tax`, `base_shipping_incl_tax`) VALUES (last_insert_id(), NULL, '0', 'billing', NULL, NULL, '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'null', '0', '0', '0', '0', '0', '0');
      COMMIT;

      tables
      CREATE TABLE `m_quote` (
      `entity_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Entity Id',
      `store_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Store Id',
      `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created At',
      `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      `converted_at` timestamp NULL DEFAULT NULL COMMENT 'Converted At',
      `is_active` smallint(5) unsigned DEFAULT '1' COMMENT 'Is Active',
      `is_virtual` smallint(5) unsigned DEFAULT '0' COMMENT 'Is Virtual',
      `is_multi_shipping` smallint(5) unsigned DEFAULT '0' COMMENT 'Is Multi Shipping',
      `items_count` int(10) unsigned DEFAULT '0' COMMENT 'Items Count',
      `items_qty` decimal(12,4) DEFAULT '0.0000' COMMENT 'Items Qty',
      `orig_order_id` int(10) unsigned DEFAULT '0' COMMENT 'Orig Order Id',
      `store_to_base_rate` decimal(12,4) DEFAULT '0.0000' COMMENT 'Store To Base Rate',
      `store_to_quote_rate` decimal(12,4) DEFAULT '0.0000' COMMENT 'Store To Quote Rate',
      `base_currency_code` varchar(255) DEFAULT NULL COMMENT 'Base Currency Code',
      `store_currency_code` varchar(255) DEFAULT NULL COMMENT 'Store Currency Code',
      `quote_currency_code` varchar(255) DEFAULT NULL COMMENT 'Quote Currency Code',
      `grand_total` decimal(12,4) DEFAULT '0.0000' COMMENT 'Grand Total',
      `base_grand_total` decimal(12,4) DEFAULT '0.0000' COMMENT 'Base Grand Total',
      `checkout_method` varchar(255) DEFAULT NULL COMMENT 'Checkout Method',
      `customer_id` int(10) unsigned DEFAULT NULL COMMENT 'Customer Id',
      `customer_tax_class_id` int(10) unsigned DEFAULT NULL COMMENT 'Customer Tax Class Id',
      `customer_group_id` int(10) unsigned DEFAULT '0' COMMENT 'Customer Group Id',
      `customer_email` varchar(255) DEFAULT NULL COMMENT 'Customer Email',
      `customer_prefix` varchar(40) DEFAULT NULL COMMENT 'Customer Prefix',
      `customer_firstname` varchar(255) DEFAULT NULL COMMENT 'Customer Firstname',
      `customer_middlename` varchar(40) DEFAULT NULL COMMENT 'Customer Middlename',
      `customer_lastname` varchar(255) DEFAULT NULL COMMENT 'Customer Lastname',
      `customer_suffix` varchar(40) DEFAULT NULL COMMENT 'Customer Suffix',
      `customer_dob` datetime DEFAULT NULL COMMENT 'Customer Dob',
      `customer_note` varchar(255) DEFAULT NULL COMMENT 'Customer Note',
      `customer_note_notify` smallint(5) unsigned DEFAULT '1' COMMENT 'Customer Note Notify',
      `customer_is_guest` smallint(5) unsigned DEFAULT '0' COMMENT 'Customer Is Guest',
      `remote_ip` varchar(45) DEFAULT NULL,
      `applied_rule_ids` varchar(255) DEFAULT NULL COMMENT 'Applied Rule Ids',
      `reserved_order_id` varchar(64) DEFAULT NULL COMMENT 'Reserved Order Id',
      `password_hash` varchar(255) DEFAULT NULL COMMENT 'Password Hash',
      `coupon_code` varchar(255) DEFAULT NULL COMMENT 'Coupon Code',
      `global_currency_code` varchar(255) DEFAULT NULL COMMENT 'Global Currency Code',
      `base_to_global_rate` decimal(12,4) DEFAULT NULL COMMENT 'Base To Global Rate',
      `base_to_quote_rate` decimal(12,4) DEFAULT NULL COMMENT 'Base To Quote Rate',
      `customer_taxvat` varchar(255) DEFAULT NULL COMMENT 'Customer Taxvat',
      `customer_gender` varchar(255) DEFAULT NULL COMMENT 'Customer Gender',
      `subtotal` decimal(12,4) DEFAULT NULL COMMENT 'Subtotal',
      `base_subtotal` decimal(12,4) DEFAULT NULL COMMENT 'Base Subtotal',
      `subtotal_with_discount` decimal(12,4) DEFAULT NULL COMMENT 'Subtotal With Discount',
      `base_subtotal_with_discount` decimal(12,4) DEFAULT NULL COMMENT 'Base Subtotal With Discount',
      `is_changed` int(10) unsigned DEFAULT NULL COMMENT 'Is Changed',
      `trigger_recollect` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Trigger Recollect',
      `ext_shipping_info` text COMMENT 'Ext Shipping Info',
      `is_persistent` smallint(5) unsigned DEFAULT '0' COMMENT 'Is Quote Persistent',
      `gift_message_id` int(11) DEFAULT NULL COMMENT 'Gift Message Id',
      `newsletter_subscribe` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Newsletter Subscribe',
      `delivery_date` datetime NOT NULL COMMENT 'Delivery Date',
      PRIMARY KEY (`entity_id`),
      KEY `m_QUOTE_CUSTOMER_ID_STORE_ID_IS_ACTIVE` (`customer_id`,`store_id`,`is_active`),
      KEY `m_QUOTE_STORE_ID` (`store_id`),
      CONSTRAINT `m_QUOTE_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `m_store` (`store_id`) ON DELETE CASCADE
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Sales Flat Quote';

      CREATE TABLE `m_quote_address` (
      `address_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Address Id',
      `quote_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Quote Id',
      `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Created At',
      `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp() COMMENT 'Updated At',
      `customer_id` int(10) unsigned DEFAULT NULL COMMENT 'Customer Id',
      `save_in_address_book` smallint(6) DEFAULT 0 COMMENT 'Save In Address Book',
      `customer_address_id` int(10) unsigned DEFAULT NULL COMMENT 'Customer Address Id',
      `address_type` varchar(10) DEFAULT NULL COMMENT 'Address Type',
      `email` varchar(255) DEFAULT NULL COMMENT 'Email',
      `prefix` varchar(40) DEFAULT NULL COMMENT 'Prefix',
      `firstname` varchar(255) DEFAULT NULL,
      `middlename` varchar(40) DEFAULT NULL,
      `lastname` varchar(255) DEFAULT NULL,
      `suffix` varchar(40) DEFAULT NULL COMMENT 'Suffix',
      `company` varchar(255) DEFAULT NULL COMMENT 'Company',
      `street` varchar(255) DEFAULT NULL COMMENT 'Street',
      `city` varchar(255) DEFAULT NULL,
      `region` varchar(255) DEFAULT NULL,
      `region_id` int(10) unsigned DEFAULT NULL COMMENT 'Region Id',
      `postcode` varchar(20) DEFAULT NULL COMMENT 'Postcode',
      `country_id` varchar(30) DEFAULT NULL COMMENT 'Country Id',
      `telephone` varchar(255) DEFAULT NULL,
      `fax` varchar(255) DEFAULT NULL,
      `same_as_billing` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Same As Billing',
      `collect_shipping_rates` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Collect Shipping Rates',
      `shipping_method` varchar(120) DEFAULT NULL,
      `shipping_description` varchar(255) DEFAULT NULL COMMENT 'Shipping Description',
      `weight` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Weight',
      `subtotal` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Subtotal',
      `base_subtotal` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Base Subtotal',
      `subtotal_with_discount` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Subtotal With Discount',
      `base_subtotal_with_discount` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Base Subtotal With Discount',
      `tax_amount` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Tax Amount',
      `base_tax_amount` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Base Tax Amount',
      `shipping_amount` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Shipping Amount',
      `base_shipping_amount` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Base Shipping Amount',
      `shipping_tax_amount` decimal(12,4) DEFAULT NULL COMMENT 'Shipping Tax Amount',
      `base_shipping_tax_amount` decimal(12,4) DEFAULT NULL COMMENT 'Base Shipping Tax Amount',
      `discount_amount` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Discount Amount',
      `base_discount_amount` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Base Discount Amount',
      `grand_total` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Grand Total',
      `base_grand_total` decimal(12,4) NOT NULL DEFAULT 0.0000 COMMENT 'Base Grand Total',
      `customer_notes` text DEFAULT NULL COMMENT 'Customer Notes',
      `applied_taxes` text DEFAULT NULL COMMENT 'Applied Taxes',
      `discount_description` varchar(255) DEFAULT NULL COMMENT 'Discount Description',
      `shipping_discount_amount` decimal(12,4) DEFAULT NULL COMMENT 'Shipping Discount Amount',
      `base_shipping_discount_amount` decimal(12,4) DEFAULT NULL COMMENT 'Base Shipping Discount Amount',
      `subtotal_incl_tax` decimal(12,4) DEFAULT NULL COMMENT 'Subtotal Incl Tax',
      `base_subtotal_total_incl_tax` decimal(12,4) DEFAULT NULL COMMENT 'Base Subtotal Total Incl Tax',
      `discount_tax_compensation_amount` decimal(12,4) DEFAULT NULL COMMENT 'Discount Tax Compensation Amount',
      `base_discount_tax_compensation_amount` decimal(12,4) DEFAULT NULL COMMENT 'Base Discount Tax Compensation Amount',
      `shipping_discount_tax_compensation_amount` decimal(12,4) DEFAULT NULL COMMENT 'Shipping Discount Tax Compensation Amount',
      `base_shipping_discount_tax_compensation_amnt` decimal(12,4) DEFAULT NULL COMMENT 'Base Shipping Discount Tax Compensation Amount',
      `shipping_incl_tax` decimal(12,4) DEFAULT NULL COMMENT 'Shipping Incl Tax',
      `base_shipping_incl_tax` decimal(12,4) DEFAULT NULL COMMENT 'Base Shipping Incl Tax',
      `free_shipping` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Free Shipping',
      `vat_id` text DEFAULT NULL COMMENT 'Vat Id',
      `vat_is_valid` smallint(6) DEFAULT NULL COMMENT 'Vat Is Valid',
      `vat_request_id` text DEFAULT NULL COMMENT 'Vat Request Id',
      `vat_request_date` text DEFAULT NULL COMMENT 'Vat Request Date',
      `vat_request_success` smallint(6) DEFAULT NULL COMMENT 'Vat Request Success',
      `gift_message_id` int(11) DEFAULT NULL COMMENT 'Gift Message Id',
      PRIMARY KEY (`address_id`),
      KEY `m_QUOTE_ADDRESS_QUOTE_ID` (`quote_id`),
      CONSTRAINT `m_QUOTE_ADDRESS_QUOTE_ID_QUOTE_ENTITY_ID` FOREIGN KEY (`quote_id`) REFERENCES `m_quote` (`entity_id`) ON DELETE CASCADE
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Sales Flat Quote Address'

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serg Sergei Golubchik
              Reporter:
              mechtrader Jamison Phillips
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: