Re: psql dynamic comments

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: "Little, Douglas" <DOUGLAS(dot)LITTLE(at)orbitz(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql dynamic comments
Date: 2010-10-06 15:40:31
Message-ID: AANLkTikKRUbxCJpCpw9jYUz96tWDcE+TCV94xtcrbSmu@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/10/6 Little, Douglas <DOUGLAS(dot)LITTLE(at)orbitz(dot)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(at)bdteste=# \set message ''''`echo 'Created by Fabrizio on '``date
'+20%y-%m-%d %H:%M:%S'`''''
postgres(at)bdteste=# comment on table city is :message;
COMMENT
postgres(at)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
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2010-10-06 17:36:23 Re: Why i see several postgres server processes sometimes ?
Previous Message Gauthier, Dave 2010-10-06 15:30:17 DB relpication how-to doc?