Problem: [PostgreSQL] Metadata service returns an error message stating the current schema and users schema are not the same


When creating the metadata tables by starting the Metadata Windows service, an error message is returned stating that the current schema is not the same as the users schema.


PostgreSQL 8.3 follows a search path through a determined list of schemas. The search path is the path the system takes to find an authenticated user’s database objects to which they have access. The first matching schema found is selected as the intended schema. If there is no match, an error is returned, even if matching table names exist in other schemas. Once SDE is installed, the default search path is set to:


The first element specifies that the schema with the same name as the current user would be searched. If no entry exists, the element is ignored and the tables are written to the public schema.

Solution or Workaround

When creating the GIS Portal Toolkit 9.3 database schema in PostgreSQL 8.3, keep the user name and schema name the same. When running the grants_pg.cmd script, make sure that the gpt schema element and gptUser element match.

grants_pg [host] [port] [sde database] [sdeUser] [gpt schema] [sde schema]

[host] is the machine name hosting PostgreSQL
[port] is the port number of PostgreSQL. Default = 5432
[sde database] is the SDE database name. Default = sde
[sdeUser] is the sde user. Default = sde
[gpt schema] is the name for the gpt schema. Default = gpt93
[sde schema] is the name of the sde schema. Default = sde
[gptUser] is the name for the gpt schema owner. Default = gpt93

Sample: grants_pg machineName 5432 sde sde gpt93 sde gpt93