Postgres local schema classifier

I use postgres schemes to group views and functions and store several versions of them in the database (sometimes this is necessary for backward compatibility), since different schemes have several versions of the same function, I can’t just refer to it by name, but you must write the full name "schema.funcname" to access it.

when accessing functions in schemaA from another function in schemaA, I always need to write schemaA.funcname. it hurts me when I rename the circuit later - is there a qualifier indicating that the function in the same circuit should be used? maybe like "this" in java?

hope it can be understood what i mean

THX

+3
source share
1

set schema, :

create schema test1;
create schema test2;

create function test1.f() returns int as $body$ begin return 1; end; $body$ language plpgsql;
create function test2.f() returns int as $body$ begin return 2; end; $body$ language plpgsql;

set schema 'test1';
select f();

set schema 'test2';
select f();

search_path :

create or replace function test1.x() returns int as $body$ begin return 1; end; $body$ language plpgsql;
create or replace function test1.f() returns int as $body$ begin return x(); end; $body$ language plpgsql set search_path = 'test1';

create or replace function test2.x() returns int as $body$ begin return 2; end; $body$ language plpgsql;
create or replace function test2.f() returns int as $body$ begin return x(); end; $body$ language plpgsql set search_path = 'test2';

select test1.f();

select test2.f();
0

All Articles