New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various parser bugs / missing features #7171
Comments
Hi, I discovered that DDLDatabase fails when script contains CREATE TABLE TASK_HISTORY
(
TIMESTAMP TIMESTAMP NOT NULL
);
CREATE INDEX TASK_HISTORY_TIMESTAMP_INDEX ON TASK_HISTORY(TIMESTAMP); The same thing happens for |
Interesting, thanks for reporting. The parser parses the CREATE INDEX TASK_HISTORY_TIMESTAMP_INDEX ON TASK_HISTORY("TIMESTAMP"); If H2 accepts the syntax, we'll have to, as well, of course |
Remaining tasks moved to #7518 |
This is a continuation of #6485 and will be continued in #7518
Some features were not yet supported in the jOOQ 3.9 parser. We'll fix them all in this single issue in order not to create too many issues. Here's the list of fixed things:
SELECT features
SEL
as a synonym for theSELECT
keyword (Teradata)DEL
forDELETE
UPD
forUPDATE
INS
forINSERT
SEEK
clauseWITH
withUNION
: e.g.WITH t(a) AS (SELECT 1) SELECT a FROM t UNION SELECT 1
WITH
with parenthesisedUNION
: e.g.WITH t(a) AS (SELECT 1) (SELECT a FROM t UNION SELECT 1)
FETCH n PERCENT ROWS
orTOP n PERCENT
clauses (support in jOOQ, first: Add support for Oracle 12c FETCH N PERCENT ROWS and SQL Server TOP n PERCENT clauses #5594)COUNT(t.*)
(support in jOOQ, first: Add DSL.count(SelectFieldOrAsterisk) and countDistinct(SelectFieldOrAsterisk) #7288)select x from ((select 1 as x) union (select 2 as x)) t
select ((select 1) union (select 2))
VALUES
in CTE:WITH a AS (VALUES (1)) SELECT * FROM a
VALUES
wherever a query primary can be used, e.g.VALUES(1, 2) UNION VALUES(2, 1)
WINDOW
clauseLIMIT
/FETCH
etc shouldn't parse anDSL.inline()
param, but a constantOther statements
CREATE INDEX .. ON t (a [ ASC | DESC ])
: Explicit sort clause in indexesCREATE INDEX .. INCLUDE
(support in jOOQ first: Add support for the CREATE INDEX .. INCLUDE syntax #7412)CREATE [ SPATIAL | FULLTEXT ] INDEX
(Unsupported in jOOQ: MySQL index types)CREATE TABLE AS WITH .. SELECT
CREATE TABLE
:KEY
clause is MySQL's equivalent for an index. The keywordINDEX
can also be used. See: Support parsing KEY/INDEX specifications in MySQL CREATE TABLE statements #7347, Add possibility of adding an INDEX (or KEY) as a "constraint" to DDL statements #7348CREATE TABLE
quoted data typesCREATE TABLE
withREFERENCES
clauses directly on column specificationCREATE OR REPLACE VIEW
(support in jOOQ first: Add CREATE OR REPLACE VIEW #7286)ALTER TABLE
: Multiple columns added in one statement (support in jOOQ first: Add support for ALTER TABLE .. ADD (...) to add multiple objects to a table at once #5318)ALTER TABLE .. RENAME TO
should accept qualified target table namesALTER TABLE .. ADD INDEX
(MySQL synonym for creating the index usingCREATE INDEX
)ALTER TABLE .. RENAME INDEX
(MySQL synonym for creating the index usingRENAME INDEX
)ALTER TABLE .. DROP INDEX
(MySQL synonym for creating the index usingDROP INDEX
)USE
command (support in jOOQ first: Add support for SET SCHEMA and SET CATALOG #7087)ON CONFLICT DO
(without constraint specification)MERGE
withoutINTO
(possible in SQL Server)MERGE
withWHERE
clauses (or SQL Server alternative withAND
clause)ENABLE
clause on constraints (Oracle)INSERT table ...
(withoutINTO
, SQL Server)Table expressions
(+)
*=
(see also: SQL Translation Error - Transact-SQL outer joins #7300). We'll simply translate this to(+)
for now. Emulation will followUNNEST
operatorgenerate_series()
Column expressions (and predicates)
DISTINCT
predicate (support in jOOQ first: Add is[Not]DistinctFrom() to Row[N] types #2051)getdate()
tFIELD
function: https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_fieldDECODE
functionTO_NUMBER()
function (single argument, convert toCAST(x AS NUMBER)
)TO_CHAR()
function (single argument, convert toCAST(x AS VARCHAR)
)TO_DATE
andTO_TIMESTAMP
functions (see also: Support parsing Oracle TO_DATE() and TO_TIMESTAMP() functions #7320)IIF
(support in jOOQ first: Add DSL.iif(Condition, Field<T>, Field<T>) #7275): https://docs.microsoft.com/en-us/sql/t-sql/functions/logical-functions-iif-transact-sqlDATEADD
et al.: https://docs.microsoft.com/en-us/sql/t-sql/functions/dateadd-transact-sqlnow()
function (see Add DSL.now() as a synonym for DSL.currentTimestamp() #7237)current_timestamp()
,current_time()
, andcurrent_date()
can be functions, not just literalsBIT_COUNT
function (MySQL)BIT_AND
,BIT_OR
,BIT_NOT
,BIT_XOR
,BIT_NAND
,BIT_NOR
,BIT_XNOR
functionsSHL
andSHR
functionsDATE
,TIME
,TIMESTAMP
,INTERVAL
column references (not literals)CAST
types (see https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html#function_cast)Literals and data types
SERIAL2
data type aliasVARCHAR2(n BYTE)
andVARCHAR2(n CHAR)
syntax (simply ignore the setting for now)Other improvements
...
around abbreviated SQL strings)unexpectedToken()
error messages (see Add more error messages to the parser #7261)New features
The text was updated successfully, but these errors were encountered: