pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
CREATE table1 FROM table2
8+ messages / 8 participants
[nested] [flat]

* CREATE table1 FROM table2
@ 2003-06-17 15:20 Rado Petrik <r.p@szm.sk>
  2003-06-17 15:31 ` Re: CREATE table1 FROM table2 Devrim GUNDUZ <devrim@gunduz.org>
  2003-06-17 15:34 ` Re: CREATE table1 FROM table2 Nicolas JOUANIN <n.jouanin@regie-france.com>
  2003-06-17 15:35 ` Re: CREATE table1 FROM table2 Tomasz Myrta <jasiek@klaster.net>
  2003-06-17 20:46 ` Re: CREATE table1 FROM table2 Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 4 replies; 8+ messages in thread

From: Rado Petrik @ 2003-06-17 15:20 UTC (permalink / raw)
  To: pgsql-sql

Hi, 

How I create table1 from other table2 . 

"cp table1 table2" 

Thanks. 

-- 
Rado Petrik <r.p@szm.sk>





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: CREATE table1 FROM table2
  2003-06-17 15:20 CREATE table1 FROM table2 Rado Petrik <r.p@szm.sk>
@ 2003-06-17 15:31 ` Devrim GUNDUZ <devrim@gunduz.org>
  2003-06-23 15:26   ` Re: CREATE table1 FROM table2 L.V.Boldareva <me@pierro.dds.nl>
  3 siblings, 1 reply; 8+ messages in thread

From: Devrim GUNDUZ @ 2003-06-17 15:31 UTC (permalink / raw)
  To: Rado Petrik <r.p@szm.sk>; +Cc: pgsql-sql


Hi,

On 17 Jun 2003, Rado Petrik wrote:

> How I create table1 from other table2 . 

CREATE TABLE table1 AS SELECT * FROM table2;

will work.

Regards,
-- 
Devrim GUNDUZ
devrim@gunduz.org				devrim.gunduz@linux.org.tr 
			http://www.tdmsoft.com
			http://www.gunduz.org




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: CREATE table1 FROM table2
  2003-06-17 15:20 CREATE table1 FROM table2 Rado Petrik <r.p@szm.sk>
  2003-06-17 15:31 ` Re: CREATE table1 FROM table2 Devrim GUNDUZ <devrim@gunduz.org>
@ 2003-06-23 15:26   ` L.V.Boldareva <me@pierro.dds.nl>
  2003-06-23 17:01     ` Re: CREATE table1 FROM table2 scott.marlowe <scott.marlowe@ihs.com>
  0 siblings, 1 reply; 8+ messages in thread

From: L.V.Boldareva @ 2003-06-23 15:26 UTC (permalink / raw)
  To: pgsql-sql

Hello!

many people posted their answer to this simple question. however,
neither
CREATE TABLE AS
nor
SELECT INTO

do not take care about keys and triggers, etc.

The commands above only copy the structure of the table, and the data.
Are there any workarounds fr copying the table as a whole object?

thanks,
Mila


> Hi,

> On 17 Jun 2003, Rado Petrik wrote:

>> How I create table1 from other table2 . 

> CREATE TABLE table1 AS SELECT * FROM table2;

> will work.

> Regards,




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: CREATE table1 FROM table2
  2003-06-17 15:20 CREATE table1 FROM table2 Rado Petrik <r.p@szm.sk>
  2003-06-17 15:31 ` Re: CREATE table1 FROM table2 Devrim GUNDUZ <devrim@gunduz.org>
  2003-06-23 15:26   ` Re: CREATE table1 FROM table2 L.V.Boldareva <me@pierro.dds.nl>
@ 2003-06-23 17:01     ` scott.marlowe <scott.marlowe@ihs.com>
  0 siblings, 0 replies; 8+ messages in thread

From: scott.marlowe @ 2003-06-23 17:01 UTC (permalink / raw)
  To: L.V.Boldareva <me@pierro.dds.nl>; +Cc: pgsql-sql

On Mon, 23 Jun 2003, L.V.Boldareva wrote:

> Hello!
> 
> many people posted their answer to this simple question. however,
> neither
> CREATE TABLE AS
> nor
> SELECT INTO
> 
> do not take care about keys and triggers, etc.
> 
> The commands above only copy the structure of the table, and the data.
> Are there any workarounds fr copying the table as a whole object?

You probably want to use pg_dump dbname -t tablename and edit the file 
thus created by hand to create a new table etc...






^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: CREATE table1 FROM table2
  2003-06-17 15:20 CREATE table1 FROM table2 Rado Petrik <r.p@szm.sk>
@ 2003-06-17 15:34 ` Nicolas JOUANIN <n.jouanin@regie-france.com>
  3 siblings, 0 replies; 8+ messages in thread

From: Nicolas JOUANIN @ 2003-06-17 15:34 UTC (permalink / raw)
  To: Rado Petrik <r.p@szm.sk>; pgsql-sql

Hi,

Documentation says:

CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name [ (column_name [,
...] ) ]
     AS query

example : create table table1 as select * from table2;


> -----Message d'origine-----
> De : pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org]De la part de Rado Petrik
> Envoyé : mardi 17 juin 2003 17:21
> À : pgsql-sql@postgresql.org
> Objet : [SQL] CREATE table1 FROM table2
>
>
> Hi,
>
> How I create table1 from other table2 .
>
> "cp table1 table2"
>
> Thanks.
>
> --
> Rado Petrik <r.p@szm.sk>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: CREATE table1 FROM table2
  2003-06-17 15:20 CREATE table1 FROM table2 Rado Petrik <r.p@szm.sk>
@ 2003-06-17 15:35 ` Tomasz Myrta <jasiek@klaster.net>
  3 siblings, 0 replies; 8+ messages in thread

From: Tomasz Myrta @ 2003-06-17 15:35 UTC (permalink / raw)
  To: Rado Petrik <r.p@szm.sk>; +Cc: pgsql-sql

Dnia 2003-06-17 17:20, Użytkownik Rado Petrik napisał:
> Hi, 
> 
> How I create table1 from other table2 . 
> 
> "cp table1 table2" 
create table2 as select * from table1;
It is described in Postgresql documentation SQL Commands -> "create table as"

Regards,
Tomasz Myrta




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: CREATE table1 FROM table2
  2003-06-17 15:20 CREATE table1 FROM table2 Rado Petrik <r.p@szm.sk>
@ 2003-06-17 20:46 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
  2003-06-17 19:10   ` Re: CREATE table1 FROM table2 Guillaume LELARGE <gleu@wanadoo.fr>
  3 siblings, 1 reply; 8+ messages in thread

From: Achilleus Mantzios @ 2003-06-17 20:46 UTC (permalink / raw)
  To: Rado Petrik <r.p@szm.sk>; +Cc: pgsql-sql

On 17 Jun 2003, Rado Petrik wrote:

> Hi, 
> 
> How I create table1 from other table2 . 
> 
> "cp table1 table2" 

create table table2 as select * from table1;

> 
> Thanks. 
> 
> 

-- 
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel:    +30-210-8981112
fax:    +30-210-8981877
email:  achill at matrix dot gatewaynet dot com
        mantzios at softlab dot ece dot ntua dot gr




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: CREATE table1 FROM table2
  2003-06-17 15:20 CREATE table1 FROM table2 Rado Petrik <r.p@szm.sk>
  2003-06-17 20:46 ` Re: CREATE table1 FROM table2 Achilleus Mantzios <achill@matrix.gatewaynet.com>
@ 2003-06-17 19:10   ` Guillaume LELARGE <gleu@wanadoo.fr>
  0 siblings, 0 replies; 8+ messages in thread

From: Guillaume LELARGE @ 2003-06-17 19:10 UTC (permalink / raw)
  To: pgsql-sql

Hi,

Le Mardi 17 Juin 2003 20:46, Achilleus Mantzios a écrit :
> On 17 Jun 2003, Rado Petrik wrote:
> > How I create table1 from other table2 .
> >
> > "cp table1 table2"
>
> create table table2 as select * from table1;
>
Another way would be:
  select * into table2 from table1;

(See 
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=sql-selectinto.html).


-- 
Guillaume <!-- http://absfr.tuxfamily.org/ -->.



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2003-06-23 17:01 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-06-17 15:20 CREATE table1 FROM table2 Rado Petrik <r.p@szm.sk>
2003-06-17 15:31 ` Devrim GUNDUZ <devrim@gunduz.org>
2003-06-23 15:26   ` L.V.Boldareva <me@pierro.dds.nl>
2003-06-23 17:01     ` scott.marlowe <scott.marlowe@ihs.com>
2003-06-17 15:34 ` Nicolas JOUANIN <n.jouanin@regie-france.com>
2003-06-17 15:35 ` Tomasz Myrta <jasiek@klaster.net>
2003-06-17 20:46 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2003-06-17 19:10   ` Guillaume LELARGE <gleu@wanadoo.fr>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox