If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > addGeometryColumn problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-24-11, 08:08
sachinites sachinites is offline
Registered User
 
Join Date: May 2011
Location: mumbai
Posts: 6
Red face 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 08:09. Reason: missed some info
Reply With Quote
  #2 (permalink)  
Old 06-30-11, 11:59
futurity futurity is offline
Registered User
 
Join Date: May 2008
Posts: 270
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);
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On