pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hélder M. Vieira <hmv@mail.telepac.pt>
To: pgsql-sql@postgresql.org
Subject: Re: Removing duplicate rows
Date: Tue, 6 Feb 2007 22:49:50 -0000
Message-ID: <000c01c74a41$1ce8ffb0$6200a8c0@hmv02> (raw)
References: <45C8FDE6.6050603@autoledgers.com.au>

> As the table definitions get updated frequently, I'd like to put in my 
> script to create the table as a copy of the existing 'real' table. I'm 
> assuming "create table as" would be what I need to use, but what would I 
> use as the select sql - i.e. how do I use select to pull the definition of 
> a table.


The create statement allows you to copy a table structure, including or 
excluding constraints.
For inclusion and exclusion effects, please read the manual info related 
with the 'like' clause of the 'create table' statement.

Ex.:
create temporary table mytesttable (like mymaintable excluding constraints 
excluding defaults);


Regards,

Hélder M. Vieira 




view thread (5+ messages)  latest in thread

Message-ID: <000c01c74a41$1ce8ffb0$6200a8c0@hmv02>
Permalink:  ../000c01c74a41$1ce8ffb0$6200a8c0@hmv02/
Also on:    postgresql.org/message-id/000c01c74a41$1ce8ffb0$6200a8c0@hmv02

 · 

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: hmv@mail.telepac.pt
  Subject: Re: Removing duplicate rows
  In-Reply-To: <000c01c74a41$1ce8ffb0$6200a8c0@hmv02>

* 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