psql dynamic comments - Mailing list pgsql-general

From Little, Douglas
Subject psql dynamic comments
Date
Msg-id 8585BA53443004458E0BAA6134C5A7FB195B1162@EGEXCMB01.oww.root.lcl
Whole thread Raw
Responses Re: psql dynamic comments
List 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.Little@orbitz.com

 cid:image001.jpg@01CABEC8.D4980670  orbitz.com | ebookers.com | hotelclub.com | cheaptickets.com | ratestogo.com | asiahotels.com

 

Attachment

pgsql-general by date:

Previous
From: "Jonathan Brinkman"
Date:
Subject: custom search_path reverts to default after DB restore
Next
From: Sairam Krishnamurthy
Date:
Subject: Re: Having two simultaneous and similar database