Results 1 to 2 of 2
  1. #1
    Join Date
    May 2011
    Location
    mumbai
    Posts
    6

    Red face Unanswered: addGeometryColumn problem

    username - giselab
    dbname - giselab
    table name - countries

    i created the country as follows :
    giselab=> create table countries (id integer primary key, name varchar (20) not null);

    it successfully created . Then i tried to add a geometry column to it as follows but i get the following error :

    giselab=> select AddGeometryColumn ('giselab', 'countries', 'geom', -1, 'GEOMETRY', 2);
    ERROR: Schema 'giselab' is not a valid schemaname
    CONTEXT: SQL statement "SELECT AddGeometryColumn('', $1 , $2 , $3 , $4 , $5 , $6 )"
    PL/pgSQL function "addgeometrycolumn" line 5 at SQL statement

    i am using postgis 1.4.2 & postgres 8.4 on ubuntu.

    what should i do ? all parametres passed to ddGeometryColumn seems correct. What is Schema , i thought its a Database name ?
    pls help !!
    Last edited by sachinites; 06-24-11 at 09:09. Reason: missed some info

  2. #2
    Join Date
    May 2008
    Posts
    277
    Quote Originally Posted by sachinites View Post
    what should i do ? all parametres passed to ddGeometryColumn seems correct. What is Schema , i thought its a Database name ?
    No, in PostgreSQL, a database can have multiple schemas, and every database has a 'public' schema by default.

    PostgreSQL: Documentation: Manuals: PostgreSQL 8.4: Schemas

    The AddGeometryColumn function has three signatures. The one you're using takes a schema name, so unless you've explicitly created your own schema for your tables, this would be 'public'.
    Code:
    select AddGeometryColumn ('public', 'countries', 'geom', -1, 'GEOMETRY', 2);
    However, the function defaults to the public schema, so you can just omit the schema name altogether:
    Code:
    select AddGeometryColumn ('countries', 'geom', -1, 'GEOMETRY', 2);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •