Special syntax sth.name() in the CREATE FUNCTION statement, what does it mean?

All we need is an easy explanation of the problem, so here it is.

In this SO question about stored procedures in plpgsql, the stored procedure look like sth.name(). I don’t know what is the meaning of the prefix sth.

For example:

create or replace function something.function_name()
returns setof record as
-- code
$$ language plpgsql;

Looking in this book in the “Part IV: Programming with PostgreSQL” I have found no mention of this type of creation declaration with a function name in two parts.

In the postgresql documentation, at the create function section, the only similar thing is when they deal about argtype or regtype than could be written in the form: table_name.column_name%TYPE. But it’s not related to the name of the function.

So, what is this syntax related to ?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

It’s the name of a schema.
In other words, a schema-qualified function name. Just like you can schema-qualify tables or views or types or even operators (you just don’t have to, normally).

Also learn about the schema search_path.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply