@dbml/core 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +201 -1
- package/lib/export/DbmlExporter.js +5 -1
- package/lib/export/JsonExporter.js +0 -0
- package/lib/export/ModelExporter.js +0 -0
- package/lib/export/MysqlExporter.js +0 -0
- package/lib/export/OracleExporter.js +0 -0
- package/lib/export/PostgresExporter.js +0 -0
- package/lib/export/README.md +0 -0
- package/lib/export/SqlServerExporter.js +0 -0
- package/lib/export/index.js +0 -0
- package/lib/export/utils.js +0 -0
- package/lib/import/index.js +0 -0
- package/lib/index.js +7 -0
- package/lib/model_structure/check.js +0 -0
- package/lib/model_structure/config.js +0 -0
- package/lib/model_structure/database.js +0 -0
- package/lib/model_structure/dbState.js +0 -0
- package/lib/model_structure/element.js +0 -0
- package/lib/model_structure/endpoint.js +0 -0
- package/lib/model_structure/enum.js +0 -0
- package/lib/model_structure/enumValue.js +0 -0
- package/lib/model_structure/field.js +0 -0
- package/lib/model_structure/indexColumn.js +0 -0
- package/lib/model_structure/indexes.js +0 -0
- package/lib/model_structure/ref.js +0 -0
- package/lib/model_structure/schema.js +0 -0
- package/lib/model_structure/stickyNote.js +0 -0
- package/lib/model_structure/table.js +0 -0
- package/lib/model_structure/tableGroup.js +0 -0
- package/lib/model_structure/tablePartial.js +0 -0
- package/lib/model_structure/utils.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/AST.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/ParserErrorListener.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/SyntaxError.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/constants.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/helpers.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/index.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mssql/README.md +263 -157
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mysql/README.md +262 -157
- package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/oraclesql/README.md +261 -157
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLLexerBase.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLParserBase.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/README.md +252 -157
- package/lib/parse/ANTLR/ASTGeneration/snowflake/README.md +236 -157
- package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.js +0 -0
- package/lib/parse/ANTLR/README.md +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexerBase.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexerBase.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserBase.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/README.md +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.js +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParserVisitor.js +0 -0
- package/lib/parse/Parser.js +0 -0
- package/lib/parse/buildParser.js +0 -0
- package/lib/parse/databaseGenerator.js +0 -0
- package/lib/parse/dbml/parser.pegjs +0 -0
- package/lib/parse/dbmlParser.js +0 -0
- package/lib/parse/error.js +0 -0
- package/lib/parse/mssql/base_parsers.js +0 -0
- package/lib/parse/mssql/column_definition/actions.js +0 -0
- package/lib/parse/mssql/column_definition/index.js +0 -0
- package/lib/parse/mssql/constraint_definition/actions.js +0 -0
- package/lib/parse/mssql/constraint_definition/index.js +0 -0
- package/lib/parse/mssql/expression.js +0 -0
- package/lib/parse/mssql/fk_definition/actions.js +0 -0
- package/lib/parse/mssql/fk_definition/index.js +0 -0
- package/lib/parse/mssql/index.js +0 -0
- package/lib/parse/mssql/index_definition/actions.js +0 -0
- package/lib/parse/mssql/index_definition/index.js +0 -0
- package/lib/parse/mssql/keyword_parsers.js +0 -0
- package/lib/parse/mssql/keyword_utils.js +0 -0
- package/lib/parse/mssql/statements/actions.js +0 -0
- package/lib/parse/mssql/statements/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/add/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/add/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/comments/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/comments/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_index/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_index/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_table/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_table/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/index.js +0 -0
- package/lib/parse/mssql/utils.js +0 -0
- package/lib/parse/mssql/whitespaces.js +0 -0
- package/lib/parse/mssqlParser.js +0 -0
- package/lib/parse/mysql/parser.pegjs +0 -0
- package/lib/parse/mysqlParser.js +0 -0
- package/lib/parse/postgresParser.js +0 -0
- package/lib/parse/postgresql/Base_rules.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Alter_table/Alter_table.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Commands.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Comment.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_index.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_normal.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_of.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_partition_of.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type_enum.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type_range.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Ignore_syntax.pegjs +0 -0
- package/lib/parse/postgresql/Expression.pegjs +0 -0
- package/lib/parse/postgresql/InitializerUtils.pegjs +0 -0
- package/lib/parse/postgresql/Keywords.pegjs +0 -0
- package/lib/parse/postgresql/get_parser.js +0 -0
- package/lib/parse/postgresql/parser.pegjs +0 -0
- package/lib/parse/schemarb/parser.pegjs +0 -0
- package/lib/parse/schemarbParser.js +0 -0
- package/lib/transform/index.js +30 -0
- package/lib/utils/version.js +0 -0
- package/package.json +3 -3
- package/types/export/ModelExporter.d.ts +0 -0
- package/types/export/index.d.ts +0 -0
- package/types/import/index.d.ts +0 -0
- package/types/index.d.ts +2 -1
- package/types/model_structure/check.d.ts +0 -0
- package/types/model_structure/database.d.ts +0 -0
- package/types/model_structure/dbState.d.ts +0 -0
- package/types/model_structure/element.d.ts +0 -0
- package/types/model_structure/endpoint.d.ts +0 -0
- package/types/model_structure/enum.d.ts +0 -0
- package/types/model_structure/enumValue.d.ts +0 -0
- package/types/model_structure/field.d.ts +0 -0
- package/types/model_structure/indexColumn.d.ts +0 -0
- package/types/model_structure/indexes.d.ts +0 -0
- package/types/model_structure/ref.d.ts +0 -0
- package/types/model_structure/schema.d.ts +0 -0
- package/types/model_structure/stickyNote.d.ts +0 -0
- package/types/model_structure/table.d.ts +0 -0
- package/types/model_structure/tableGroup.d.ts +0 -0
- package/types/model_structure/tablePartial.d.ts +0 -0
- package/types/parse/Parser.d.ts +0 -0
- package/types/parse/error.d.ts +0 -0
- package/types/transform/index.d.ts +7 -0
|
@@ -1,157 +1,261 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
|
48
|
-
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
|
84
|
-
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
|
96
|
-
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
|
105
|
-
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
|
114
|
-
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
|
123
|
-
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
|
|
|
129
|
-
|
|
|
130
|
-
|
|
|
131
|
-
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
|
136
|
-
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
|
147
|
-
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
|
156
|
-
|
|
157
|
-
|
|
|
1
|
+
# Oracle SQL Parser Support
|
|
2
|
+
|
|
3
|
+
> Comprehensive documentation for the Oracle SQL model structure generator based on the ANTLR4 parser.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This module provides SQL parsing capabilities for Oracle databases, enabling conversion of Oracle DDL statements to DBML format. The parser supports Oracle-specific syntax including `GENERATED AS IDENTITY` columns, function-based indexes, and comprehensive `ALTER TABLE ADD CONSTRAINT` operations. Oracle has the best `ALTER TABLE` support among all supported databases.
|
|
8
|
+
|
|
9
|
+
## Support Legend
|
|
10
|
+
|
|
11
|
+
| Symbol | Meaning |
|
|
12
|
+
|--------|---------|
|
|
13
|
+
| ✓ | Fully supported and correctly parsed |
|
|
14
|
+
| ◐ | Valid SQL that is parsed, but some options/clauses are ignored |
|
|
15
|
+
| ✗ | Valid Oracle syntax, but the parser fails to generate output |
|
|
16
|
+
| — | Syntax not valid in Oracle |
|
|
17
|
+
|
|
18
|
+
## Key Capabilities
|
|
19
|
+
|
|
20
|
+
- **Data Definition**
|
|
21
|
+
- `CREATE TABLE` with full syntax support
|
|
22
|
+
- Data types: parameterized types (e.g., `VARCHAR2(255)`, `NUMBER(10,2)`)
|
|
23
|
+
- **Constraints**
|
|
24
|
+
- `PRIMARY KEY` (column-level, table-level, multi-column, with explicit name)
|
|
25
|
+
- `FOREIGN KEY` with `ON DELETE` actions (`ON UPDATE` not supported by Oracle)
|
|
26
|
+
- `UNIQUE`, `CHECK`, `DEFAULT`, `NOT NULL`
|
|
27
|
+
- **Auto-increment**
|
|
28
|
+
- `GENERATED AS IDENTITY`
|
|
29
|
+
- `GENERATED ALWAYS` / `GENERATED BY DEFAULT` AS IDENTITY
|
|
30
|
+
- **Indexes**
|
|
31
|
+
- `CREATE INDEX` (basic, multi-column, unique)
|
|
32
|
+
- Function-based indexes (e.g., `UPPER(column)`)
|
|
33
|
+
- **Comments**
|
|
34
|
+
- `COMMENT ON TABLE` / `COMMENT ON COLUMN` statements
|
|
35
|
+
- **Schema Modification**
|
|
36
|
+
- `ALTER TABLE ADD CONSTRAINT` (best support among all DBMS)
|
|
37
|
+
- Supports: `DEFAULT`, `NOT NULL`, `CHECK`, `UNIQUE`, `PRIMARY KEY`, `FOREIGN KEY`
|
|
38
|
+
- **Data Manipulation**
|
|
39
|
+
- Basic `INSERT` only (Oracle uses `INSERT ALL` for multi-row)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Feature Support Matrix
|
|
44
|
+
|
|
45
|
+
### `CREATE TABLE`
|
|
46
|
+
|
|
47
|
+
| Feature | Status | Notes |
|
|
48
|
+
|---------|---------|-------|
|
|
49
|
+
| Basic `CREATE TABLE` syntax | ✓ | |
|
|
50
|
+
| Enumerated data types | — | Not supported in Oracle (supported in Oracle 23ai) |
|
|
51
|
+
| Parameterized types `name(...)` | ✓ | e.g., `VARCHAR2(255)`, `NUMBER(10,2)` |
|
|
52
|
+
| Array types `name[...]` | — | Oracle uses VARRAY differently |
|
|
53
|
+
| TEMPORARY tables | ◐ | Parsed but no indication of temporary status |
|
|
54
|
+
| `CREATE TABLE` AS SELECT | ✗ | |
|
|
55
|
+
| Table options (TABLESPACE, etc.) | ◐ | Options are ignored |
|
|
56
|
+
|
|
57
|
+
### Constraints
|
|
58
|
+
|
|
59
|
+
#### `PRIMARY KEY`
|
|
60
|
+
|
|
61
|
+
| Feature | Status | Notes |
|
|
62
|
+
|---------|---------|-------|
|
|
63
|
+
| Column-level `PRIMARY KEY` | ✓ | Defined with column: `id NUMBER PRIMARY KEY` |
|
|
64
|
+
| Table-level `PRIMARY KEY` | ✓ | Defined separately: `PRIMARY KEY (id)` |
|
|
65
|
+
| Multi-column `PRIMARY KEY` | ✓ | Multiple columns: `PRIMARY KEY (a, b)` |
|
|
66
|
+
| Explicitly named (CONSTRAINT name) | ✓ | `CONSTRAINT pk_name PRIMARY KEY (id)` |
|
|
67
|
+
| DEFERRABLE / NOT DEFERRABLE | ◐ | Constraint timing options are ignored |
|
|
68
|
+
|
|
69
|
+
#### `FOREIGN KEY`
|
|
70
|
+
|
|
71
|
+
| Feature | Status | Notes |
|
|
72
|
+
|---------|---------|-------|
|
|
73
|
+
| Column-level `FOREIGN KEY` | ✓ | `col NUMBER REFERENCES other(id)` |
|
|
74
|
+
| Table-level `FOREIGN KEY` | ✓ | `FOREIGN KEY (col) REFERENCES other(id)` |
|
|
75
|
+
| Multi-column `FOREIGN KEY` | ✓ | `FOREIGN KEY (a, b) REFERENCES other(x, y)` |
|
|
76
|
+
| Explicitly named (CONSTRAINT name) | ✓ | `CONSTRAINT fk_name FOREIGN KEY ...` |
|
|
77
|
+
| `ON UPDATE` action | — | Oracle does not support `ON UPDATE` |
|
|
78
|
+
| `ON DELETE` action | ✓ | CASCADE, SET NULL, NO ACTION |
|
|
79
|
+
| DEFERRABLE / NOT DEFERRABLE | ◐ | Constraint timing options are ignored |
|
|
80
|
+
|
|
81
|
+
#### `UNIQUE`
|
|
82
|
+
|
|
83
|
+
| Feature | Status | Notes |
|
|
84
|
+
|---------|---------|-------|
|
|
85
|
+
| Column-level `UNIQUE` | ✓ | `col NUMBER UNIQUE` |
|
|
86
|
+
| Table-level `UNIQUE` | ✓ | `UNIQUE (col)` |
|
|
87
|
+
| Multi-column `UNIQUE` | ✓ | `UNIQUE (a, b)` |
|
|
88
|
+
| Explicitly named (CONSTRAINT name) | ✓ | `CONSTRAINT uq_name UNIQUE (col)` |
|
|
89
|
+
| DEFERRABLE / NOT DEFERRABLE | ◐ | Constraint timing options are ignored |
|
|
90
|
+
| NULLS NOT DISTINCT | ◐ | Treats NULLs as equal - option is ignored |
|
|
91
|
+
| `UNIQUE KEY`/`UNIQUE INDEX` | — | MySQL syntax; use `CREATE INDEX` |
|
|
92
|
+
|
|
93
|
+
#### `CHECK`
|
|
94
|
+
|
|
95
|
+
| Feature | Status | Notes |
|
|
96
|
+
|---------|---------|-------|
|
|
97
|
+
| Column-level `CHECK` | ✓ | `col NUMBER CHECK (col > 0)` |
|
|
98
|
+
| Table-level `CHECK` | ✓ | `CHECK (col > 0)` |
|
|
99
|
+
| Explicitly named (CONSTRAINT name) | ✓ | `CONSTRAINT chk_name CHECK (col > 0)` |
|
|
100
|
+
| ENABLE / DISABLE options | ◐ | Enforcement options are ignored |
|
|
101
|
+
|
|
102
|
+
#### `DEFAULT`
|
|
103
|
+
|
|
104
|
+
| Feature | Status | Notes |
|
|
105
|
+
|---------|---------|-------|
|
|
106
|
+
| Column-level `DEFAULT` | ✓ | `col NUMBER DEFAULT 0` |
|
|
107
|
+
| Table-level `DEFAULT` | — | Oracle only supports column-level `DEFAULT` |
|
|
108
|
+
| Function as `DEFAULT` | ✓ | `DEFAULT SYSDATE`, `DEFAULT SYS_GUID()` |
|
|
109
|
+
| Explicitly named `DEFAULT` | — | Oracle doesn't support named `DEFAULT` constraints |
|
|
110
|
+
|
|
111
|
+
#### `NOT NULL` / NULL
|
|
112
|
+
|
|
113
|
+
| Feature | Status | Notes |
|
|
114
|
+
|---------|---------|-------|
|
|
115
|
+
| Column-level `NOT NULL` | ✓ | `col NUMBER NOT NULL` |
|
|
116
|
+
| NULL (explicitly nullable) | ✓ | `col NUMBER NULL` |
|
|
117
|
+
| Table-level `NOT NULL` | — | Oracle only supports column-level `NOT NULL` |
|
|
118
|
+
| DEFERRABLE / NOT DEFERRABLE | ◐ | Constraint timing options are ignored |
|
|
119
|
+
|
|
120
|
+
### Auto-Increment Columns
|
|
121
|
+
|
|
122
|
+
| Feature | Status | Notes |
|
|
123
|
+
|---------|---------|-------|
|
|
124
|
+
| `GENERATED AS IDENTITY` (column property) | ✓ | `id NUMBER GENERATED AS IDENTITY` |
|
|
125
|
+
| `GENERATED ALWAYS AS IDENTITY` (column property) | ✓ | Database always generates value |
|
|
126
|
+
| `GENERATED BY DEFAULT AS IDENTITY` (column property) | ✓ | Database generates if no value provided |
|
|
127
|
+
| START WITH / INCREMENT BY | ◐ | Sequence options are ignored |
|
|
128
|
+
| `AUTO_INCREMENT` (column attribute) | — | MySQL syntax - not valid in Oracle |
|
|
129
|
+
| `SERIAL` (pseudo-type) | — | PostgreSQL syntax - not valid in Oracle |
|
|
130
|
+
| `BIGSERIAL` (pseudo-type) | — | PostgreSQL syntax - not valid in Oracle |
|
|
131
|
+
| `IDENTITY(seed, increment)` (column property) | — | SQL Server/Snowflake syntax - not valid in Oracle |
|
|
132
|
+
|
|
133
|
+
### Inline Indexes (in `CREATE TABLE`)
|
|
134
|
+
|
|
135
|
+
| Feature | Status | Notes |
|
|
136
|
+
|---------|---------|-------|
|
|
137
|
+
| Column-level indexes | — | Oracle uses separate `CREATE INDEX` statement |
|
|
138
|
+
| Table-level indexes | ✓ | Via constraint definitions |
|
|
139
|
+
| Named indexes | ✓ | Index name specified with constraint |
|
|
140
|
+
| Multi-column indexes | ✓ | Multiple columns in constraint |
|
|
141
|
+
| CLUSTERED/NONCLUSTERED | — | SQL Server syntax - not valid in Oracle |
|
|
142
|
+
| Index options | ◐ | Options are ignored |
|
|
143
|
+
|
|
144
|
+
### Table/Column Comments (in `CREATE TABLE`)
|
|
145
|
+
|
|
146
|
+
| Feature | Status | Notes |
|
|
147
|
+
|---------|---------|-------|
|
|
148
|
+
| Table comments | ✓ | Via `COMMENT ON TABLE` statement |
|
|
149
|
+
| Column comments | ✓ | Via `COMMENT ON COLUMN` statement |
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### `CREATE INDEX`
|
|
154
|
+
|
|
155
|
+
| Feature | Status | Notes |
|
|
156
|
+
|---------|---------|-------|
|
|
157
|
+
| Basic `CREATE INDEX` | ✓ | `CREATE INDEX idx ON table (col)` |
|
|
158
|
+
| Multi-column index | ✓ | `CREATE INDEX idx ON table (a, b)` |
|
|
159
|
+
| Explicitly named index | ✓ | Index name is required in Oracle |
|
|
160
|
+
| `UNIQUE` index | ✓ | `CREATE UNIQUE INDEX idx ON table (col)` |
|
|
161
|
+
| Function-based index | ✓ | `CREATE INDEX ON t (UPPER(col))` |
|
|
162
|
+
| Partial/Filtered index (WHERE clause) | ◐ | WHERE condition is ignored |
|
|
163
|
+
| BITMAP index | — | Parsed but type not captured |
|
|
164
|
+
| BTREE/HASH/GIST/BRIN/GIN | — | PostgreSQL syntax - not applicable to Oracle |
|
|
165
|
+
| INCLUDE columns | — | Not supported in Oracle |
|
|
166
|
+
| CLUSTERED/NONCLUSTERED | — | SQL Server syntax - not valid in Oracle |
|
|
167
|
+
| COLLATE | ◐ | Collation settings are ignored |
|
|
168
|
+
| Index comments | ◐ | Comments are ignored |
|
|
169
|
+
| NULLS FIRST/LAST | — | Oracle uses different syntax |
|
|
170
|
+
| ASC/DESC | ◐ | Sort direction is ignored |
|
|
171
|
+
| FULLTEXT/SPATIAL | — | Oracle uses different syntax (Oracle Text, Spatial) |
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### `INSERT` Statements
|
|
176
|
+
|
|
177
|
+
| Feature | Status | Notes |
|
|
178
|
+
|---------|---------|-------|
|
|
179
|
+
| Basic `INSERT` ... VALUES | ✓ | `INSERT INTO t (col) VALUES (1)` |
|
|
180
|
+
| Multi-row `INSERT` | — | Oracle uses `INSERT ALL` syntax |
|
|
181
|
+
| `INSERT` ... SELECT | ✗ | Subquery as data source |
|
|
182
|
+
| WITH clause (CTE) | ✗ | CTE before `INSERT` |
|
|
183
|
+
| Target table alias | ✗ | `INSERT INTO t alias ...` |
|
|
184
|
+
| `INSERT` ... RETURNING | ◐ | Returns inserted rows - clause is ignored |
|
|
185
|
+
| `INSERT ALL` (multi-table insert) | ✗ | Oracle-specific multi-table insert |
|
|
186
|
+
| Conditional `INSERT` (WHEN/FIRST/ALL) | ✗ | Oracle syntax for conditional inserts |
|
|
187
|
+
| `INSERT` OVERWRITE | — | Snowflake/Hive syntax - not valid in Oracle |
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
### `ALTER TABLE`
|
|
192
|
+
|
|
193
|
+
| Feature | Status | Notes |
|
|
194
|
+
|---------|---------|-------|
|
|
195
|
+
| **ADD COLUMN** | | |
|
|
196
|
+
| - All column properties | ✗ | |
|
|
197
|
+
| **DROP COLUMN** | ✗ | |
|
|
198
|
+
| **ALTER COLUMN / MODIFY** | | |
|
|
199
|
+
| - `COMMENT` | — | Use `COMMENT ON` statement |
|
|
200
|
+
| - Other modifications | ✗ | |
|
|
201
|
+
| **RENAME COLUMN** | ✗ | |
|
|
202
|
+
| **ADD CONSTRAINT** | | |
|
|
203
|
+
| - Named `DEFAULT` | ✓ | Best among all DBMS |
|
|
204
|
+
| - Named `NOT NULL` | ✓ | Best among all DBMS |
|
|
205
|
+
| - NULL | ✓ | |
|
|
206
|
+
| - Named `CHECK` | ✓ | |
|
|
207
|
+
| - Unnamed `CHECK` | ✓ | |
|
|
208
|
+
| - Named `UNIQUE` | ✓ | |
|
|
209
|
+
| - Unnamed `UNIQUE` | ✓ | |
|
|
210
|
+
| - Named `PRIMARY KEY` | ✓ | |
|
|
211
|
+
| - Unnamed `PRIMARY KEY` | ✓ | |
|
|
212
|
+
| - Named `FOREIGN KEY` | ✓ | |
|
|
213
|
+
| - Unnamed `FOREIGN KEY` | ✓ | |
|
|
214
|
+
| **DROP CONSTRAINT** | ✗ | |
|
|
215
|
+
| **ALTER CONSTRAINT** | ✗ | |
|
|
216
|
+
| **RENAME TABLE** | ✗ | |
|
|
217
|
+
| **SET SCHEMA** | ✗ | |
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### Other DDL Statements
|
|
222
|
+
|
|
223
|
+
| Feature | Status | Notes |
|
|
224
|
+
|---------|---------|-------|
|
|
225
|
+
| `DROP TABLE` | ✗ | |
|
|
226
|
+
| `DROP INDEX` | ✗ | |
|
|
227
|
+
| `ALTER INDEX` | ✗ | |
|
|
228
|
+
| `CREATE VIEW` | ✗ | |
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
### Comments (`COMMENT ON`)
|
|
233
|
+
|
|
234
|
+
| Feature | Status | Notes |
|
|
235
|
+
|---------|---------|-------|
|
|
236
|
+
| `COMMENT ON TABLE` | ✓ | |
|
|
237
|
+
| `COMMENT ON COLUMN` | ✓ | |
|
|
238
|
+
| COMMENT ... IS NULL | ✓ | Removes comment |
|
|
239
|
+
| `COMMENT ON INDEX` | ✗ | |
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Known Limitations
|
|
244
|
+
|
|
245
|
+
- **`ON UPDATE` for `FOREIGN KEY`**: Oracle does not support `ON UPDATE` actions for foreign keys; only `ON DELETE` is available
|
|
246
|
+
- **Multi-row `INSERT`**: Oracle uses `INSERT ALL` syntax which is not currently supported
|
|
247
|
+
- **DDL modification statements**: `DROP TABLE`, `DROP INDEX`, `ALTER INDEX` not supported
|
|
248
|
+
- **`INSERT` ... SELECT**: Subqueries in `INSERT` statements not supported
|
|
249
|
+
- **`CREATE VIEW`**: View definitions are not parsed
|
|
250
|
+
- **Enumerated Types**: Not supported in Oracle (introduced in Oracle 23ai)
|
|
251
|
+
- **Increment options for `IDENTITY`**: START WITH, INCREMENT BY options are parsed but ignored
|
|
252
|
+
|
|
253
|
+
## Oracle-Specific Notes
|
|
254
|
+
|
|
255
|
+
1. **`GENERATED AS IDENTITY`**: Oracle fully supports the SQL standard `GENERATED AS IDENTITY` syntax. Both `GENERATED ALWAYS` and `GENERATED BY DEFAULT` variants are supported
|
|
256
|
+
2. **`ALTER TABLE ADD CONSTRAINT`**: Oracle has the most comprehensive `ALTER TABLE ADD CONSTRAINT` support, including `DEFAULT`, `NOT NULL`, `CHECK`, `UNIQUE`, `PRIMARY KEY`, and `FOREIGN KEY` - all fully functional
|
|
257
|
+
3. **Function-based Indexes**: Oracle's function-based indexes (e.g., `CREATE INDEX ON t (UPPER(col))`) are fully supported
|
|
258
|
+
4. **`ON DELETE` Only**: Oracle foreign keys only support `ON DELETE` actions (`CASCADE`, `SET NULL`, `NO ACTION`). There is no `ON UPDATE` support
|
|
259
|
+
5. **Comments**: Use `COMMENT ON TABLE/COLUMN` statements. These are separate DDL statements, not inline with `CREATE TABLE`
|
|
260
|
+
6. **No Multi-row `INSERT`**: Oracle uses `INSERT ALL ... SELECT` syntax for multi-row inserts, which differs from other databases
|
|
261
|
+
7. **`VARCHAR2`**: Oracle uses `VARCHAR2` (not `VARCHAR`) as the standard variable-length string type
|
|
File without changes
|
|
File without changes
|
|
File without changes
|