Suppose I have a query :-

select 'public.test123 is' || ' ' || quote_literal(obj_description('public.test123'::regclass)) || ';' as test;
     public.test123 is 'dog';
(1 row)

I want to create a function named comment that will help me pass the schema_name and table-name(public and test123) as in above query, and provide me the above output.

And then insert this output to another table public.entries with the table name passed and output of the query in comment column like below-

select * from public.entries;
table_name | comment
public.test123 | public.test123 is 'dog';
(1 rows)

and return the function with SUCCESS.

Output like:-

select comment('public','test123');
  • 1
    It seems you have nearly everything to write that function. Where are you stuck? – dezso Aug 28 '18 at 9:30
  • @dezso Can you help me create this function? – Subhashis Dey Aug 28 '18 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.