Note: I’m asking because the answer to the question “Why isn’t X supported?” is always useful. For example, if
supportingit would imply a logical impossibility that I’m too slow to spot, it helps me when someone explains what I
failedto realize. Equally, it helps me to know when the answer is “It’s just a historical accident. It could have been
supported.But, now that it isn’t, it doesn’t seem worth the effort to bridge that gap” because this shows me that my
existingmental model is sound.
The background for my question here is that among the documented changes that you can make using “alter function”
https://www.postgresql.org/docs/current/sql-alterfunction.html
you can specify all of them at “create time” too (but possibly, like “owner”, only implicitly) except for “depends on
extension”.When you know in advance that you want to set this property, you need two statements:
create function f()
returns int
language plpgsql
as $body$
begin
return 42;
end;
$body$;
alter function f()
depends on extension pgcrypto;
Why is this not supported:
create function f()
returns int
language plpgsql
depends on extension pgcrypto
as $body$
begin
return 42;
end;
$body$;