JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

Snowflake IFF and CURRENT_TIMESTAMP(n) support

Open kattelus opened this issue 8 years ago • 2 comments

Hi. I have been testing parser with snowflake sql and have found couple of sqls not possible to parse. Would it be possible to support these cases?

IFF statement: Single-level if-then-else expression. Similar to CASE, but only allows a single condition. https://docs.snowflake.net/manuals/sql-reference/functions/iff.html

CURRENT_TIMESTAMP with <fract_sec_precision> parameter https://docs.snowflake.net/manuals/sql-reference/functions/current_timestamp.html

Actual Behavior

Parsing exception.

Expected Behavior

Parsing should success.

Steps to Reproduce the Problem

  1. select current_timestamp(3);
  2. select iff(1 > 0, 'true', 'false');

Specifications

  • Version: 1.2

kattelus avatar Jun 15 '18 07:06 kattelus

Could possibly be done, if you feel like tackling this yourself you can start by looking at this: https://github.com/JSQLParser/JSqlParser/blob/master/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt#L136

I've done this before in #405

AnEmortalKid avatar Jun 30 '18 17:06 AnEmortalKid

no answer

wumpz avatar Jan 03 '21 00:01 wumpz