<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">Hi,</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">As a follow-up to my earlier post (<span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; white-space: nowrap; background-color: rgb(242, 242, 242); "><a href="http://36ohk6dgmcd1n.c.yom.mail.yahoo.net/om/api/1.0/openmail.app.invoke/36ohk6dgmcd1n/5/1.0.35/de/de-DE/view.html" title="Klicken, um nach Messages mit gleichem Betreff zu suchen" data-action="search" class="subanchor" style="text-decoration: none; color: rgb(51, 51, 51); outline-style: none; outline-width: initial; outline-color: initial; overflow-x: hidden;
 overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; ">Re: [postgis-users] schemas and postgis data</a>)</span> I have another question.</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">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</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">create table data.new_table as (select * from public.old_table);</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">although this works, the schema is not copied..ie the primary key
 and other contraints are missing.</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">So i have done this</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"># first create new table and copy schema</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">create table data.table_2(like table_1 including defaults including constraints including indexes);</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">#then copy data into table_2</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">insert into
 data.table2(select * from public.table_1);</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">Is there a better/quicker/safer way of doing this? possibly with pgadmin3?</font></div></div><div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div></div></div></body></html>