Thread: Hacking gram.y Error syntax error at or near "MERGEJOIN"

Hacking gram.y Error syntax error at or near "MERGEJOIN"

From
HuangQi
Date:
Hi,
    I'm doing a hacking project which hacks the gram.y file and some other so that postgres can execute some query plan language to run a particular plan. I did some modifications and try run it. It compiled and installed successfully. But when I was trying to run a MergeJoin operation with keyword MERGEJOIN, it says "ERROR: syntax error at or near 'MERGEJOIN'". It seems postgres didn't recognize this keyword. Is it caused by any error inside gram.y? Or how can I trace this error?

--
Best Regards
Huang Qi Victor

Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

From
Pavel Stehule
Date:
Hello

you should to add new keywords to
postgresql/src/include/parser/kwlist.h (depends on pg version)

attention - keywords must be in alphabet order

Regards

Pavel Stehule

2011/6/2 HuangQi <huangqiyx@gmail.com>:
> Hi,
>     I'm doing a hacking project which hacks the gram.y file and some other
> so that postgres can execute some query plan language to run a particular
> plan. I did some modifications and try run it. It compiled and installed
> successfully. But when I was trying to run a MergeJoin operation with
> keyword MERGEJOIN, it says "ERROR: syntax error at or near 'MERGEJOIN'". It
> seems postgres didn't recognize this keyword. Is it caused by any error
> inside gram.y? Or how can I trace this error?
>
> --
> Best Regards
> Huang Qi Victor
>


Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

From
HuangQi
Date:
Yes, I've also added mergejoin to kwlist.h as unreserved_keyword. In order to build AST, I also keep a new node struct in planoperators.h and a new node tag inside nodes.h. 

On 2 June 2011 15:49, Pavel Stehule <pavel.stehule@gmail.com> wrote:
Hello

you should to add new keywords to
postgresql/src/include/parser/kwlist.h (depends on pg version)

attention - keywords must be in alphabet order

Regards

Pavel Stehule

2011/6/2 HuangQi <huangqiyx@gmail.com>:
> Hi,
>     I'm doing a hacking project which hacks the gram.y file and some other
> so that postgres can execute some query plan language to run a particular
> plan. I did some modifications and try run it. It compiled and installed
> successfully. But when I was trying to run a MergeJoin operation with
> keyword MERGEJOIN, it says "ERROR: syntax error at or near 'MERGEJOIN'". It
> seems postgres didn't recognize this keyword. Is it caused by any error
> inside gram.y? Or how can I trace this error?
>
> --
> Best Regards
> Huang Qi Victor
>



--
Best Regards
Huang Qi Victor

Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

From
Pavel Stehule
Date:
Hello

2011/6/2 HuangQi <huangqiyx@gmail.com>:
> Yes, I've also added mergejoin to kwlist.h as unreserved_keyword. In order
> to build AST, I also keep a new node struct in planoperators.h and a new
> node tag inside nodes.h.
>

then recheck alphabet order of keywords, else recheck bison rules.

Pavel


> On 2 June 2011 15:49, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>>
>> Hello
>>
>> you should to add new keywords to
>> postgresql/src/include/parser/kwlist.h (depends on pg version)
>>
>> attention - keywords must be in alphabet order
>>
>> Regards
>>
>> Pavel Stehule
>>
>> 2011/6/2 HuangQi <huangqiyx@gmail.com>:
>> > Hi,
>> >     I'm doing a hacking project which hacks the gram.y file and some
>> > other
>> > so that postgres can execute some query plan language to run a
>> > particular
>> > plan. I did some modifications and try run it. It compiled and installed
>> > successfully. But when I was trying to run a MergeJoin operation with
>> > keyword MERGEJOIN, it says "ERROR: syntax error at or near 'MERGEJOIN'".
>> > It
>> > seems postgres didn't recognize this keyword. Is it caused by any error
>> > inside gram.y? Or how can I trace this error?
>> >
>> > --
>> > Best Regards
>> > Huang Qi Victor
>> >
>
>
>
> --
> Best Regards
> Huang Qi Victor
>


Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

From
Andrew Dunstan
Date:

On 06/02/2011 03:28 AM, HuangQi wrote:
> Hi,
>     I'm doing a hacking project which hacks the gram.y file and some 
> other so that postgres can execute some query plan language to run a 
> particular plan. I did some modifications and try run it. It compiled 
> and installed successfully. But when I was trying to run a MergeJoin 
> operation with keyword MERGEJOIN, it says "ERROR: syntax error at or 
> near 'MERGEJOIN'". It seems postgres didn't recognize this keyword. Is 
> it caused by any error inside gram.y? Or how can I trace this error?
>
>

Without seeing your grammar changes and the statement you're trying to 
execute it's pretty much impossible to tell.

cheers

andrew


Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

From
Heikki Linnakangas
Date:
On 02.06.2011 15:16, Andrew Dunstan wrote:
> On 06/02/2011 03:28 AM, HuangQi wrote:
>> Hi,
>> I'm doing a hacking project which hacks the gram.y file and some other
>> so that postgres can execute some query plan language to run a
>> particular plan. I did some modifications and try run it. It compiled
>> and installed successfully. But when I was trying to run a MergeJoin
>> operation with keyword MERGEJOIN, it says "ERROR: syntax error at or
>> near 'MERGEJOIN'". It seems postgres didn't recognize this keyword. Is
>> it caused by any error inside gram.y? Or how can I trace this error?
>
> Without seeing your grammar changes and the statement you're trying to
> execute it's pretty much impossible to tell.

Yeah. One more guess is that you didn't include the keyword in the 
keyword list at the end of gram.y. There's script to check various 
keyword-related things at src/tools/check_keywords.pl

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

From
HuangQi
Date:
Hi, thanks a lot for your ideas. But I've done all these things. I've checked the gram.y and kwlist.h files many times but can not find what's wrong. So is there any possibility that the problem comes from something after parser, though it seems it should comes from parser?

On 2 June 2011 21:14, Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> wrote:
On 02.06.2011 15:16, Andrew Dunstan wrote:
On 06/02/2011 03:28 AM, HuangQi wrote:
Hi,
I'm doing a hacking project which hacks the gram.y file and some other
so that postgres can execute some query plan language to run a
particular plan. I did some modifications and try run it. It compiled
and installed successfully. But when I was trying to run a MergeJoin
operation with keyword MERGEJOIN, it says "ERROR: syntax error at or
near 'MERGEJOIN'". It seems postgres didn't recognize this keyword. Is
it caused by any error inside gram.y? Or how can I trace this error?

Without seeing your grammar changes and the statement you're trying to
execute it's pretty much impossible to tell.

Yeah. One more guess is that you didn't include the keyword in the keyword list at the end of gram.y. There's script to check various keyword-related things at src/tools/check_keywords.pl

--
 Heikki Linnakangas
 EnterpriseDB   http://www.enterprisedb.com



--
Best Regards
Huang Qi Victor

Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

From
Alvaro Herrera
Date:
Excerpts from HuangQi's message of jue jun 02 11:17:21 -0400 2011:
> Hi, thanks a lot for your ideas. But I've done all these things. I've
> checked the gram.y and kwlist.h files many times but can not find what's
> wrong. So is there any possibility that the problem comes from something
> after parser, though it seems it should comes from parser?

If you want more input, post the patch.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

From
Robert Haas
Date:
On Thu, Jun 2, 2011 at 11:17 AM, HuangQi <huangqiyx@gmail.com> wrote:
> Hi, thanks a lot for your ideas. But I've done all these things. I've
> checked the gram.y and kwlist.h files many times but can not find what's
> wrong. So is there any possibility that the problem comes from something
> after parser, though it seems it should comes from parser?

It seems very unlikely, but you could probably find out the answer
yourself by using a debugger.  Set a breakpoint on errfinish and see
where the error gets thrown from.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

From
HuangQi
Date:
Thanks all for your ideas. Though wired, I reinstalled the Postgres and tried again. This error message disappears. The
parsernow works good.<br /><br /><div class="gmail_quote">On 3 June 2011 01:13, Alvaro Herrera <span dir="ltr"><<a
href="mailto:alvherre@commandprompt.com">alvherre@commandprompt.com</a>></span>wrote:<br /><blockquote
class="gmail_quote"style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Excerpts from HuangQi's
messageof jue jun 02 11:17:21 -0400 2011:<br /><div class="im">> Hi, thanks a lot for your ideas. But I've done all
thesethings. I've<br /> > checked the gram.y and kwlist.h files many times but can not find what's<br /> > wrong.
Sois there any possibility that the problem comes from something<br /> > after parser, though it seems it should
comesfrom parser?<br /><br /></div>If you want more input, post the patch.<br /><font color="#888888"><br /> --<br />
ÁlvaroHerrera <<a href="mailto:alvherre@commandprompt.com">alvherre@commandprompt.com</a>><br /> The PostgreSQL
Company- Command Prompt, Inc.<br /> PostgreSQL Replication, Consulting, Custom Development, 24x7 support<br
/></font></blockquote></div><br/><br clear="all" /><br />-- <br />Best Regards<br />Huang Qi Victor<br />