Re: Help using SELECT INTO to make schema

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Robert James <srobertjames(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Help using SELECT INTO to make schema
Date: 2009-07-23 00:40:32
Message-ID: 1248309632.23273.180.camel@monkey-cat.sm.truviso.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2009-07-22 at 18:15 -0400, Robert James wrote:
> I'd like to SELECT INTO one table into another one. However, I'd like
> to do two things that I don't know how to do using SELECT INTO:
>
> 1. Copy over the indexes and constraints of the first table into the
> second

See: http://www.postgresql.org/docs/8.4/static/sql-createtable.html
LIKE parent_table [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS |
INDEXES } ]

> 2. Do SELECT INTO even if the second table already exists.

INSERT INTO foo ... SELECT

Regards,
Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Cheng 2009-07-23 04:49:42 Re: Problem search on text arrays, using the overlaps (&&) operator
Previous Message Tom Lane 2009-07-22 23:49:41 Re: Can LIKE under utf8 use INDEXes?