pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Florian Weimer <fweimer@bfk.de>
To: Julien Cigar <jcigar@ulb.ac.be>
Cc: pgsql-sql@postgresql.org
Subject: Re: new table with a select
Date: Thu, 25 Aug 2011 10:44:16 +0000
Message-ID: <821uw993en.fsf@mid.bfk.de> (raw)
In-Reply-To: <4E561A6A.60807@ulb.ac.be>
References: <20110825104435.68556k0yyck63vr7@mail.sapo.pt>
	<4E561A6A.60807@ulb.ac.be>

* Julien Cigar:

> create table foo as select * from bar;
>
> just add "where 1=2" if you just want the schema

There's also this:

  CREATE TABLE foo (LIKE bar);

This gives you more control over what aspects of the table are
duplicated; see the documentation for details.

-- 
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99



view thread (5+ messages)  latest in thread

Message-ID: <821uw993en.fsf@mid.bfk.de>
Permalink:  ../821uw993en.fsf@mid.bfk.de/
Also on:    postgresql.org/message-id/821uw993en.fsf@mid.bfk.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: fweimer@bfk.de, jcigar@ulb.ac.be
  Subject: Re: new table with a select
  In-Reply-To: <821uw993en.fsf@mid.bfk.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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