Re: psql dynamic comments - Mailing list pgsql-general

From Fabrízio de Royes Mello
Subject Re: psql dynamic comments
Date
Msg-id AANLkTikKRUbxCJpCpw9jYUz96tWDcE+TCV94xtcrbSmu@mail.gmail.com
Whole thread Raw
In response to psql dynamic comments  ("Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>)
List pgsql-general


2010/10/6 Little, Douglas <DOUGLAS.LITTLE@orbitz.com>

 

 

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?

 



Try this:


postgres@bdteste=# \set message ''''`echo 'Created by Fabrizio on '``date '+20%y-%m-%d %H:%M:%S'`''''
postgres@bdteste=# comment on table city is :message;
COMMENT
postgres@bdteste=# \dt+ city
                                      Lista de relações
 Esquema | Nome |  Tipo  |   Dono   |  Tamanho   |                 Descrição                  
---------+------+--------+----------+------------+--------------------------------------------
 public  | city | tabela | postgres | 8192 bytes | Created by Fabrizio on 2010-10-06 12:39:04
(1 linha)


--
Fabrízio de Royes Mello
>> Blog sobre TI: http://fabriziomello.blogspot.com

pgsql-general by date:

Previous
From: Sairam Krishnamurthy
Date:
Subject: Re: Having two simultaneous and similar database
Next
From: "Gauthier, Dave"
Date:
Subject: DB relpication how-to doc?