Re: Identifying ALTER TABLE "sub-command"
Jeremy Finzel wrote: > Hello - > > I have found that in leveraging the parser code to decode DDL SQL, it is > very easy to get which type of general command is being issued with > CreateCommandTag(parsetree). However, is there a way (or a starting point) > to identify the sub-command as well i.e. ENABLE TRIGGER, ADD FOREIGN KEY, > etc.? Hi Jeremy, See the test code in src/test/modules/test_ddl_deparse/test_ddl_deparse.c It might give you some ideas. -- Álvaro Herrerahttps://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Re: Identifying ALTER TABLE "sub-command"
HelloYou can start with functions ATPrepCmd and ATExecCmd in src/backend/commands/tablecmds.cAlso note, one alter table statement can have multiple different actions. Regards, Sergei11.01.2018, 18:56, "Jeremy Finzel":Hello -I have found that in leveraging the parser code to decode DDL SQL, it is very easy to get which type of general command is being issued with CreateCommandTag(parsetree). However, is there a way (or a starting point) to identify the sub-command as well i.e. ENABLE TRIGGER, ADD FOREIGN KEY, etc.?Any direction is much appreciated.Thanks,Jeremy
Identifying ALTER TABLE "sub-command"
Hello - I have found that in leveraging the parser code to decode DDL SQL, it is very easy to get which type of general command is being issued with CreateCommandTag(parsetree). However, is there a way (or a starting point) to identify the sub-command as well i.e. ENABLE TRIGGER, ADD FOREIGN KEY, etc.? Any direction is much appreciated. Thanks, Jeremy