Hello,
Is it possible to create a new schema in a PostGres/PostGIS database using FME?
Thanks
Hello,
Is it possible to create a new schema in a PostGres/PostGIS database using FME?
Thanks
Hi @jackyd, yes, you can create a new schema with a SQL statement. e.g.
create schema my_schema
Where? depends on how you write features into tables belonging to the new schema. If you write features with a PostgreSQL/PostGIS writer, for example, you can set the statement to the "SQL Statement to Execute before Translation" parameter of the writer.Note: The execution will fail if the schema exists in the database already, but the error can be ignored if you add a hyphen to the head of the statement, like this.
-create schema my_schema
Hi @jackyd, yes, you can create a new schema with a SQL statement. e.g.
create schema my_schema
Where? depends on how you write features into tables belonging to the new schema. If you write features with a PostgreSQL/PostGIS writer, for example, you can set the statement to the "SQL Statement to Execute before Translation" parameter of the writer.Note: The execution will fail if the schema exists in the database already, but the error can be ignored if you add a hyphen to the head of the statement, like this.
-create schema my_schema
Thank you so much @takashi this just what i need.
@takashi, I've never seen that hyphen trick, is it documented somewhere?
You can also do it like this, which may be slightly more understandable when you stumble upon it later:
CREATE SCHEMA IF NOT EXISTS schema_name
Documentation here: https://www.postgresql.org/docs/9.3/static/sql-createschema.html
@takashi, I've never seen that hyphen trick, is it documented somewhere?
You can also do it like this, which may be slightly more understandable when you stumble upon it later:
CREATE SCHEMA IF NOT EXISTS schema_name
Documentation here: https://www.postgresql.org/docs/9.3/static/sql-createschema.html
"An individual statement may be preceded with a hyphen, indicating that errors should be ignored."
It's convenient in some cases.
"An individual statement may be preceded with a hyphen, indicating that errors should be ignored."
It's convenient in some cases.