Re: Fwd: How parser works and to add keyword to keywords.h

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pankaj Bagul <bagul(dot)p(dot)a(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fwd: How parser works and to add keyword to keywords.h
Date: 2014-11-10 15:27:06
Message-ID: 25678.1415633226@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Pankaj Bagul <bagul(dot)p(dot)a(at)gmail(dot)com> writes:
> Can anyone tell about how parser works and if we want to add a new keyword
> to the keywords.h,
> and how to use that keyword ? How the all process works ?

The minimum requirements are as stated in gram.y: add the keyword to
kwlist.h, to the "%token <keyword>" list near the head of gram.y, and
to the appropriate one of the keyword category lists near the bottom
of gram.y. Presumably you want to use this keyword in some production
or other, so you'll also need to add or modify parsetree node struct types
to represent the output from the production. Best bet really is to
identify some existing SQL language feature that is somewhat related
to what you want to do, and then grep the PG source code for all mentions
of the related parse node type(s). There's usually a pretty fair amount
of boilerplate support code that you'll need to add or modify, but copy
and paste is your friend for that.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G Johnston 2014-11-10 15:30:06 Re: row_to_json bug with index only scans: empty keys!
Previous Message Magnus Hagander 2014-11-10 15:19:36 Re: remove pg_standby?