Comments on tables

Поиск
Список
Период
Сортировка
Искать

Comments on tables

От:
pasman pasmański <pasman.p@gmail.com>
Дата:
Hello.


How to add comment on table with calculated value ?

COMMENT ON TABLE test IS 'Updated ' || current_date;

not works ...

Regards.

------------
pasman

Re: Comments on tables

От:
Szymon Guz <mabewlun@gmail.com>
Дата:
2010/11/10 pasman pasmański <pasman.p@gmail.com>
Hello.


How to add comment on table with calculated value ?

COMMENT ON TABLE test IS 'Updated ' || current_date;

not works ...


Hi,
I'd suggest something like this:

do $$
begin
  execute 'COMMENT ON TABLE test_count is ''Updated ' || current_date || '''';
end$$; 

This would run on postgres from 9.0, for earlier versions, you could always write similar function.


regards
Szymon

Re: Comments on tables

От:
Vibhor Kumar <vibhor.kumar@enterprisedb.com>
Дата:

On Nov 10, 2010, at 2:55 PM, pasman pasmański wrote:

> How to add comment on table with calculated value ?
> 
> COMMENT ON TABLE test IS 'Updated ' || current_date;


You can create function to do that.

Or 

If you are using PG9.0, then DO would help you, as given below:
do $$
Declare
t text;
begin
t:='COMMENT ON TABLE TEST_COPY IS '||''''||'TEST WITH '||current_date||'''';
execute t;
end;
$$ language plpgsql;

Thanks & Regards,
Vibhor Kumar


Re: Comments on tables

От:
Pasman <pasman.p@gmail.com>
Дата:
> do $$
> begin
>   execute 'COMMENT ON TABLE test_count is ''Updated ' || current_date ||
> '''';
> end$$;
>

thanks, it works cool.


pasman

FAQ