select (now();
just like so.. but it doesn't works:
ALTER TABLE old_name RENAME TO new_name || select now();
CodePudding user response:
You can try to use RENAME
and SET DEFAULT
ALTER TABLE T
RENAME old_name TO new_name;
ALTER TABLE T
ALTER COLUMN new_name
SET DEFAULT now();
CodePudding user response:
You need a dynamic command in a function or do block, e.g.:
do $$
begin
execute format('alter table old_name rename to "new_name_%s"', now());
end $$;