Re: Fwd: How parser works and to add keyword to keywords.h - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Fwd: How parser works and to add keyword to keywords.h
Date
Msg-id 25678.1415633226@sss.pgh.pa.us
Whole thread Raw
In response to Fwd: How parser works and to add keyword to keywords.h  (Pankaj Bagul <bagul.p.a@gmail.com>)
List pgsql-hackers
Pankaj Bagul <bagul.p.a@gmail.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



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: remove pg_standby?
Next
From: David G Johnston
Date:
Subject: Re: row_to_json bug with index only scans: empty keys!