Mark McKelvy
Mark McKelvy

Reputation: 3536

Loading Postgres functions with dependencies

I'm using quite a few Postgres functions (both sql and pl/pgsql) in a particular application. Some of the sql functions depend on other sql functions, e.g.

create or replace function my_function ()
  returns table (a text, b text) as
    $$
      select * from my_other_function();
    $$
  language sql;

For my_function to load properly, my_other_function has to be loaded first, else I get a my_other_function does not exist error. To manage this, I have been manually ensuring that my_other_function does get loaded first, but it would be nice not to have to do that.

In other words, is there a way to load all of my functions without regard to order and somehow check that all the necessary dependencies are available (function objects) after the fact?

I'm using Postgres 9.6.

Upvotes: 3

Views: 316

Answers (1)

sticky bit
sticky bit

Reputation: 37467

You can use SETcheck_function_bodies= false; prior creating your functions to suppress the error.

Upvotes: 5

Related Questions