Skip to content

Parser fails on TSQL "NEXT VALUE FOR"? #1177

@manticore-projects

Description

@manticore-projects

Parser 4.1 can't parse:

-- SELECT
select /*+PARALLEL*/
	a.id_fee_type
	, concat('New fee ' , a.id_fee_type)
    , NEXT VALUE FOR cfe.id_fee_type_ref
	from (
	select distinct
		id_fee_type
	from
		cfe.SCHEDULE
	union select
		id_fee_type
	from
		cfe.ONE_TIME_PAYMENT
	) a left join cfe.FEE_TYPE b on a.id_fee_type=b.id_fee_type
where
	b.id_fee_type is null
	and not a.id_fee_type is null
;

I dug into the code and found that NextValExpression deparses into NEXTVAL FOR (and the query gets parsed with NEXTVAL FOR).
However, this does not seem to be valid TSQL according to https://docs.microsoft.com/en-us/sql/t-sql/functions/next-value-for-transact-sql?view=sql-server-ver15. Is this a bug or a feature? (I am not MS SQL Server guy).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions