Repository navigation
Conversation
Add CreateTablespace and AlterTablespace. MySQL options reuse the TableOption models (plus FILE_BLOCK_SIZE) and PostgreSQL parameters reuse the storage-parameter lists. CREATE UNDO requires ADD DATAFILE, undo tablespaces accept only ENGINE, and ALTER rejects FILE_BLOCK_SIZE. ALTER TABLESPACE forms outside this grammar, such as Oracle or NDB data file clauses, still parse as UnsupportedStatement. ALTER TABLE ALL IN TABLESPACE remains AlterTablespaceMove. Signed-off-by: minleejae <mmj9808@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Parse MySQL and PostgreSQL
CREATE TABLESPACEandALTER TABLESPACE. TodayCREATE TABLESPACEfails in every configuration, for exampleCREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENGINE=InnoDBandCREATE TABLESPACE fast OWNER u1 LOCATION '/ssd1/pg'.ALTER TABLESPACE fast RENAME TO fasterparses only as anUnsupportedStatementtoken list. Tools that read schema scripts therefore cannot see a tablespace's name, data file, location or options.Current design (As-is)
Create()has no tablespace alternative.CREATE TABLESPACEreachesCreateIndex()and fails there, atADD(MySQL) or at the end of the statement (PostgreSQL).Alter()captures everyALTER TABLESPACEstatement as anUnsupportedStatement. Only the PostgreSQL bulk moveALTER TABLE|INDEX|MATERIALIZED VIEW ALL IN TABLESPACE … SET TABLESPACE …is modeled, asAlterTablespaceMove.ENGINE,ENCRYPTION,AUTOEXTEND_SIZEandENGINE_ATTRIBUTEareTableOptionkinds, parsed by the shared CREATE/ALTER TABLE option productions.WITH (…),SET (…)andRESET (…)lists areIndexOptionlists or names, as inCREATE TABLE … WITHandALTER INDEX … SET/RESET.Target design (To-be)
CreateTablespace. It records:UNDOkeyword;LOCATION(StringValue) and theWITHparameters (List<IndexOption>);ADD DATAFILEfile (StringValue) and the options (List<TableOption>) in source order.AlterTablespace, with an explicitAction:RENAME(RENAME TO);OWNER(OWNER TO),SET_PARAMETERS(SET (…)) andRESET_PARAMETERS(RESET (…));SET_STATE(ALTER UNDO TABLESPACE … SET ACTIVE|INACTIVE) andOPTIONS.TableOptionvalues. The only new kind isTableOption.Kind.FILE_BLOCK_SIZE, which only tablespaces use.PostgreSqlIndexOptions();RESETkeeps names, asALTER INDEX … RESETdoes.sql_yacc.yy, PostgreSQL 18gram.y):CREATE UNDO TABLESPACErequiresADD DATAFILE, and undo tablespaces accept onlyENGINE. ALTER rejectsFILE_BLOCK_SIZE.LOCATION. A statement cannot mix PostgreSQL and MySQL clauses.UNDO,DATAFILE,LOCATION,OWNER,INACTIVE,FILE_BLOCK_SIZE) are matched in context. No new keywords are reserved.CREATE [UNDO] TABLESPACEalways parses toCreateTablespace. It failed before, so invalid forms still raise a parse error.ALTER [UNDO] TABLESPACEbecomesAlterTablespaceonly when its grammar matches the whole statement. A known option that the clause does not define, such asFILE_BLOCK_SIZEafter ALTER, raises a parse error.ALTER TABLESPACEforms still parse toUnsupportedStatement, as before. These include OracleADD DATAFILE … SIZE,OFFLINEandENCRYPTION ONLINE …, and NDBADD DATAFILEandWAIT.AlterTablespaceMoveis unchanged.USE LOGFILE GROUP,INITIAL_SIZE,MAX_SIZE,EXTENT_SIZE,NODEGROUP,WAIT,COMMENT) and theSTORAGE ENGINEspelling;DROP TABLESPACE.StatementVisitordefaults,StatementVisitorAdapter,StatementDeParserandTablesNamesFinder(no tables; parameter values are visited);Feature.createTablespaceandFeature.alterTablespace. The MySQL 8.0 and PostgreSQL capabilities andFeaturesAllowed.CREATE/ALTERenable them;MODIFIES_SCHEMA.Validation
FILE_BLOCK_SIZEafter ALTER, mixed PostgreSQL/MySQL clauses and PostgreSQL values without=;ALTER TABLESPACEforms that stayUnsupportedStatement, also inside scripts;AlterTablespaceMove, and clause words used as identifiers or tablespace names;spotlessApply check: 10,412 tests, 10,387 passed, 25 skipped, zero failures/errors. The grammar choice conflict check passes.master(bdf8ac31) on a corpus of 635 MySQL 8.4 and PostgreSQL 18 DDL/DCL statements, each accepted by the server, plus variants:toString()on a second, identical server, in the same order. All 207 MySQL and 329 PostgreSQL statements give the same result (success, or the same error).Integration validation
Applied #2806–#2819 together on
master(bdf8ac31), with the stacked PRs on top of their bases (#2806 → #2807 → #2808, #2806 → #2809 → #2810 and #2811 → #2812).master. Between the branches, conflicts are limited to adjacent additions (README/index rows, usage sections, imports, visitor and feature lists, one enum line and one alias guard).spotlessApply check: 11,494 tests, 11,469 passed, 25 skipped, zero failures/errors. The grammar choice conflict check passes.master: 206) and 363 of 364 PostgreSQL statements (master: 328). Every MySQL 8.4 non-reserved word and PostgreSQL 18 unreserved or column-name keyword parses as a column and table name.