Re: Identifying ALTER TABLE "sub-command"

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Jeremy Finzel <finzelj(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Identifying ALTER TABLE "sub-command"
Date: 2018-01-11 16:25:22
Message-ID: 20180111162522.fbfwt5v5hr3b6s4v@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chapman Flack 2018-01-11 16:30:53 Re: numeric regression test passes, but why?
Previous Message Alvaro Herrera 2018-01-11 16:23:55 Re: numeric regression test passes, but why?