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

Started by HuangQiover 14 years ago10 messages
#1HuangQi
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

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: HuangQi (#1)
Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

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>:

Show quoted text

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

#3HuangQi
huangqiyx@gmail.com
In reply to: Pavel Stehule (#2)
Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

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

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: HuangQi (#3)
Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

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

Show quoted text

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

#5Andrew Dunstan
andrew@dunslane.net
In reply to: HuangQi (#1)
Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

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

#6Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Andrew Dunstan (#5)
Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

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

#7HuangQi
huangqiyx@gmail.com
In reply to: Heikki Linnakangas (#6)
Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

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

#8Robert Haas
robertmhaas@gmail.com
In reply to: HuangQi (#7)
Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

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

#9Alvaro Herrera
alvherre@commandprompt.com
In reply to: HuangQi (#7)
Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

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

#10HuangQi
huangqiyx@gmail.com
In reply to: Alvaro Herrera (#9)
Re: Hacking gram.y Error syntax error at or near "MERGEJOIN"

Thanks all for your ideas. Though wired, I reinstalled the Postgres and
tried again. This error message disappears. The parser now works good.

On 3 June 2011 01:13, Alvaro Herrera <alvherre@commandprompt.com> wrote:

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

--
Best Regards
Huang Qi Victor