Re: Lexer issues - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: Lexer issues
Date
Msg-id CAOBaU_ZO0YkU5Aj7gQVLy8mNpijEWkyO3SP4Tn2Hg4Yn8bGzHg@mail.gmail.com
Whole thread Raw
In response to Lexer issues  (Patrick REED <patrickreed352@gmail.com>)
Responses Re: Lexer issues  (Patrick REED <patrickreed352@gmail.com>)
List pgsql-hackers
Hello,

On Mon, Apr 13, 2020 at 4:04 PM Patrick REED <patrickreed352@gmail.com> wrote:
>
> I am experimenting with postgres and am wondering if there is any tutorial on how to properly add a new command to
postgres.
>
> I want to add a new constraint on "CREATE ROLE" that requires an integer, it has an identifier that is not a known
(reservedor unreserved keyword) in postgres, say we call it TestPatrick. In other words, I want to do this "CREATE ROLE
XTestPatrick=10". I am having an issue with having postgres recognize my new syntax. 
>
> I have seen this video: https://www.youtube.com/watch?v=uSEXTcEiXGQ and was able to add have my postgres compile with
myadded word (modified gram.y, kwlist.h, gram.cpp etc based on the video). However, when I use my syntax on a client
session,it still doesn't recognize my syntax... Are there any specific lexer changes I need to make? I followed the
exampleof CONNECTION LIMIT and tried to mimic it for Create ROLE. 

I'd think that if you can get a successful compilation with a modified
gram.y (and any kwlist change needed) the new syntax should be
accepted (at least up to the parser, whether the utility command is
properly handled is another thing), since there's a single version of
the CreateRoleStmt.  Is there any chance that you're somehow
connecting to something else than the freshly make-install-ed binary,
or that the error is coming from later stage than parsing?



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: index paths and enable_indexscan
Next
From: David Rowley
Date:
Subject: Re: [PATCH] Keeps tracking the uniqueness with UniqueKey