Hi list !
I am struggeling to get a function to work.
The purpose of this function is to be able to configure a schema
with different kinds of tables and functions whenever a new user
us created.
This schema is a 'user' schema : there is one for every user, but
they don't have all the same configurations.
I created a procedure like this :
CREATE OR REPLACE FUNCTION configure_schema(varchar) RETURNS VOID
AS $function$
BEGIN
SET search_path TO $1;
CREATE TABLE blablabla [...];
SELECT AddGeometryColumn($1,'table','my_geometry',12345,'GEOMETRY',2);
[...]
END;
$function$ LANGUAGE plpgsql;
So I want to be able to call this function with the schema name as
a parameter, so that all underlying queries are run in the
appropriate schema.
First of all, I have an error at 'SET search_path TO $1;' near $1.
I don't know how I should write this in a function ?
Then, I really need to pass the schema name as a parameter,
because the PostGIS function AddGeometryColumn needs the schema
name as the first parameter.
What is the correct way to achieve this ?
Thanks a lot !
--
Arnaud