On Sep 22, 2011, at 6:29 AM, Robert Buckley wrote:

> Hi,
> 
> As a follow-up to my earlier post (Re: [postgis-users] schemas and postgis 
> data) I have another question.
> 
> I had originally put all my data into the public schema. I want to move my 
> geodata to the schema "data", so I just used to following command in the 
> pgadmin3 sql editor
> 
> create table data.new_table as (select * from public.old_table);


Don't recreate the tables. Just alter the schema. Check the Pg docs for 
changing the schema.


> 
> although this works, the schema is not copied..ie the primary key and other 
> contraints are missing.
> 
> So i have done this
> 
> # first create new table and copy schema
> create table data.table_2(like table_1 including defaults including 
> constraints including indexes);
> 
> #then copy data into table_2
> insert into data.table2(select * from public.table_1);
> 
> Is there a better/quicker/safer way of doing this? possibly with 
> pgadmin3?_______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to