Skip to content

Conversation

@cryo-zd
Copy link
Contributor

@cryo-zd cryo-zd commented Dec 25, 2025

What problem does this PR solve?

Issue Number: close #64948
This PR checked TTL constraints and removed them( if set ) when executing statement create temporary table temp like t;

Problem Summary:

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. contribution This PR is from a community contributor. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Dec 25, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 25, 2025

Hi @cryo-zd. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@tiprow
Copy link

tiprow bot commented Dec 25, 2025

Hi @cryo-zd. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@YangKeao YangKeao self-requested a review December 30, 2025 06:07
if referTblInfo.TTLInfo != nil {
// for issue #64948, temporary table does not support TLL, we should remove it
if s.TemporaryKeyword != ast.TemporaryNone {
tblInfo.TTLInfo = nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, it'd be better to validate after it builds the table. I'd suggest to add the check in (*DDLExec).createSessionTemporaryTable: if tblInfo.TTLInfo != nil {return dbterror.ErrTempTableNotAllowedWithTTL}.

Because for other cases, create table like and create global temporary table like ON COMMIT DELETE ROWS;, they are also validated after BuildTableInfoWithLike.

@YangKeao
Copy link
Member

Good job. I've checked the following case (on tidb master branch):

mysql> create table t (id int primary key, created_time datetime) TTL = created_time + interval 24 hour;
Query OK, 0 rows affected (0.04 sec)

mysql> create temporary table t1 like t;
Query OK, 0 rows affected (0.00 sec)

mysql> create temporary table t2 (id int primary key, created_time datetime) TTL = created_time + interval 24 hour;
ERROR 8151 (HY000): Set TTL for temporary table is not allowed
mysql> create global temporary table t2 like t ON COMMIT DELETE ROWS;
ERROR 8151 (HY000): Set TTL for temporary table is not allowed

It seems that the create temporary table like is the only issue.

@YangKeao
Copy link
Member

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Dec 30, 2025
@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.5885%. Comparing base (7dea15e) to head (2cc6edd).
⚠️ Report is 51 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #65246        +/-   ##
================================================
+ Coverage   70.7643%   71.5885%   +0.8241%     
================================================
  Files          1901       1906         +5     
  Lines        518640     527459      +8819     
================================================
+ Hits         367012     377600     +10588     
+ Misses       127111     125408      -1703     
+ Partials      24517      24451        -66     
Flag Coverage Δ
integration 48.2342% <78.5714%> (+0.0674%) ⬆️
unit 66.0548% <50.0000%> (+0.5110%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.8700% <ø> (ø)
parser ∅ <ø> (∅)
br 59.2026% <ø> (+0.9679%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@YangKeao YangKeao requested a review from GMHDBJD December 30, 2025 12:11
Copy link
Member

@YangKeao YangKeao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 30, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 31, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GMHDBJD, YangKeao

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 31, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 31, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-12-30 12:11:45.532042678 +0000 UTC m=+99461.350351100: ☑️ agreed by YangKeao.
  • 2025-12-31 06:25:37.263655148 +0000 UTC m=+165093.081963579: ☑️ agreed by GMHDBJD.

@hawkingrei
Copy link
Member

/retest

5 similar comments
@YangKeao
Copy link
Member

/retest

@YangKeao
Copy link
Member

/retest

@YangKeao
Copy link
Member

/retest

@YangKeao
Copy link
Member

/retest

@YangKeao
Copy link
Member

/retest

@ti-chi-bot ti-chi-bot bot merged commit b9034ca into pingcap:master Dec 31, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved contribution This PR is from a community contributor. lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should check the TTL constraints in create temporary table like ...

4 participants