Re: Removing duplicate rows - Mailing list pgsql-sql

From Hélder M. Vieira
Subject Re: Removing duplicate rows
Date
Msg-id 000c01c74a41$1ce8ffb0$6200a8c0@hmv02
Whole thread Raw
In response to Removing duplicate rows  (Paul Lambert <paul.lambert@autoledgers.com.au>)
List pgsql-sql
> 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 



pgsql-sql by date:

Previous
From: Paul Lambert
Date:
Subject: Re: Removing duplicate rows
Next
From: Thomas Kellerer
Date:
Subject: Re: Removing duplicate rows