Pretty printed trigger in psql - Mailing list pgsql-hackers

From Takahiro Itagaki
Subject Pretty printed trigger in psql
Date
Msg-id 20100112180622.C529.52131E4D@oss.ntt.co.jp
Whole thread Raw
Responses Re: Pretty printed trigger in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Pretty printed trigger in psql  ("Brad T. Sliger" <brad@sliger.org>)
List pgsql-hackers
Psql shows too many parentheses when it prints triggers with WHEN clause.

postgres=# \d t1
      Table "public.t1"
 Column |  Type   | Modifiers
--------+---------+-----------
 c1     | integer |
Triggers:
    mytrig AFTER UPDATE ON t1 FOR EACH ROW
    WHEN ((old.c1 <> new.c1)) EXECUTE PROCEDURE myfunc()
          ^                ^

The attached patch eliminates unneeded parentheses by using
pg_get_triggerdef(pretty = true) in psql.

Triggers:
    mytrig AFTER UPDATE ON t1 FOR EACH ROW
    WHEN (old.c1 <> new.c1) EXECUTE PROCEDURE myfunc()

I think this change is harmless because we don't use
pg_get_triggerdef(pretty = true) in any programs, including pg_dump.

Is this change ok?

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center

Attachment

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Hot Standy introduced problem with query cancel behavior
Next
From: Dimitri Fontaine
Date:
Subject: Re: mailing list archiver chewing patches