IITDBGroup / gprom

GProM is a middleware that adds support for provenance to database backends.
http://www.cs.iit.edu/%7edbgroup/research/gprom.php
Apache License 2.0
8 stars 5 forks source link

Parser Error in TPC-H Queries Involving the 'EXTRACT' Clause #104

Closed niceIrene closed 9 months ago

niceIrene commented 9 months ago

Hi, I am currently running GProM with TPC-H queries, I noticed queries that include an extract clause would cause a parser error. For example, consider the following query: select extract(year from o_orderdate) as o_year from orders limit 1;

When I execute it using backend dbms, no error occurs: \b select extract(year from o_orderdate) as o_year from orders limit 1;

However, when I run: select extract(year from o_orderdate) as o_year from orders limit 1;

It gave a parser error as follows:

Error occured (./oracle_parser.l:310) syntax error, unexpected FROM, expecting ')' or ',' at from

ABORT BASED ON EXCEPTION wipe

May I know how I should rewrite such queries to avoid that parser error? Thanks a lot!

lordpretzel commented 9 months ago

GProM does not support exactly the same syntax as postgres. It does not support EXTRACT(x FROM y).

You can use the date_part function in Postgres instead ... date_part('YEAR', '2019-01-01'::date);

niceIrene commented 9 months ago

Thank you so much! the data_part function works.