Pretty printed trigger in psql

From: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Pretty printed trigger in psql
Date: 2010-01-12 09:06:22
Message-ID: 20100112180622.C529.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
pretty-printed-trigger_20100112.patch application/octet-stream 9.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2010-01-12 09:19:59 Re: damage control mode
Previous Message Dimitri Fontaine 2010-01-12 09:05:56 Re: mailing list archiver chewing patches