Thread: Comments on tables
Hello. How to add comment on table with calculated value ? COMMENT ON TABLE test IS 'Updated ' || current_date; not works ... Regards. ------------ pasman
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
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
> do $$ > begin > execute 'COMMENT ON TABLE test_count is ''Updated ' || current_date || > ''''; > end$$; > thanks, it works cool. pasman