psql dynamic comments

From: "Little, Douglas" <DOUGLAS(dot)LITTLE(at)orbitz(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: psql dynamic comments
Date: 2010-10-06 15:16:14
Message-ID: 8585BA53443004458E0BAA6134C5A7FB195B1162@EGEXCMB01.oww.root.lcl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm trying to generate a comment on all my changes - so I know when they were completed.

Does anybody have anything that does this.

I think the psql script is something like

d1gp1=> \set currtime `date '+20%y-%m-%d %H:%M:%S'`
d1gp1=> \echo :currtime
2010-10-06 10:01:51

d1gp1=> comment on index mdm_mart_tbls.mdm_gotoastcampaignevt_pk is 'created by dwda-1618 on :currtime';
COMMENT

Unfortunately the variable doesn't get replaced due to the quotes.
COMMENT ON INDEX mdm_mart_tbls.mdm_gotoastcampaignevt_pk IS 'created by dwda-1618 on :currtime';

I've tried various options, 2,3,4 quotes. Concatenation, Building the entire string as the variable. But nothing seems to work.

Any suggestions?

Thanks in advance.
Doug

Doug Little

Sr. Data Warehouse Architect | Enterprise Data Management | Orbitz Worldwide
500 W. Madison, Suite 1000 Chicago IL 60661| Office 312.260.2588 | Fax 312.894.5164 | Cell 847-997-5741
Douglas(dot)Little(at)orbitz(dot)com<mailto:Douglas(dot)Little(at)orbitz(dot)com>
[cid:image001(dot)jpg(at)01CB653A(dot)CDF51290] orbitz.com<http://www.orbitz.com/> | ebookers.com<http://www.ebookers.com/> | hotelclub.com<http://www.hotelclub.com/> | cheaptickets.com<http://www.cheaptickets.com/> | ratestogo.com<http://www.ratestogo.com/> | asiahotels.com<http://www.asiahotels.com/>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sairam Krishnamurthy 2010-10-06 15:23:08 Re: Having two simultaneous and similar database
Previous Message Alvaro Herrera 2010-10-06 14:51:12 Re: stuck spinlock detected at dynahash.c