pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
create table like syntax
4+ messages / 3 participants
[nested] [flat]

* create table like syntax
@ 2005-10-06 03:04  David Durham <ddurham@vailsys.com>
  0 siblings, 2 replies; 4+ messages in thread

From: David Durham @ 2005-10-06 03:04 UTC (permalink / raw)
  To: pgsql-admin

is there a syntax that would look something like:

     create table newTable like oldTable without indexes || records || 
constraints with indexes || records || constraints

built into postgres?



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

* Re: create table like syntax
@ 2005-10-06 03:36  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: David Durham <ddurham@vailsys.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Alvaro Herrera @ 2005-10-06 03:36 UTC (permalink / raw)
  To: David Durham <ddurham@vailsys.com>; +Cc: pgsql-admin

On Wed, Oct 05, 2005 at 10:04:10PM -0500, David Durham wrote:
> is there a syntax that would look something like:
> 
>     create table newTable like oldTable without indexes || records || 
> constraints with indexes || records || constraints
> 
> built into postgres?

What do you want to do with it?  If I understand what you want to do, it
is supported as long as you use ; in place of your ||.

-- 
Alvaro Herrera                         Architect, http://www.EnterpriseDB.com
"La fuerza no está en los medios físicos
sino que reside en una voluntad indomable" (Gandhi)



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

* Re: create table like syntax
@ 2005-10-07 12:36  Gaetano Mendola <mendola@bigfoot.com>
  parent: David Durham <ddurham@vailsys.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Gaetano Mendola @ 2005-10-07 12:36 UTC (permalink / raw)
  To: David Durham <ddurham@vailsys.com>

David Durham wrote:
> is there a syntax that would look something like:
> 
>     create table newTable like oldTable without indexes || records ||
> constraints with indexes || records || constraints
> 
> built into postgres?
> 

Try this:

create table newTable as
select * from oldTable limit 0;



Regards
Gaetano Mendola




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

* Re: create table like syntax
@ 2005-10-07 14:48  David Durham <ddurham@vailsys.com>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 4+ messages in thread

From: David Durham @ 2005-10-07 14:48 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-admin

Alvaro Herrera wrote:
> On Wed, Oct 05, 2005 at 10:04:10PM -0500, David Durham wrote:
> 
>>is there a syntax that would look something like:
>>
>>    create table newTable like oldTable without indexes || records || 
>>constraints with indexes || records || constraints
>>
>>built into postgres?
> 
> 
> What do you want to do with it?  If I understand what you want to do, it
> is supported as long as you use ; in place of your ||.


Well, I should say that the with and without should probably be mutually 
exclusive.  I don't know, haven't thought about it that much, but I find 
myself creating a lot of the same table over and over from time to time 
as I try to analyze some data.  Would be nice to say, hey, create a copy 
of this table with indexes and possibly records and constraints.  Or 
just a bare copy or something like that, but have a lot of different 
options for this kind of thing.


- Dave




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


end of thread, other threads:[~2005-10-07 14:48 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-06 03:04 create table like syntax David Durham <ddurham@vailsys.com>
2005-10-06 03:36 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2005-10-07 14:48   ` David Durham <ddurham@vailsys.com>
2005-10-07 12:36 ` Gaetano Mendola <mendola@bigfoot.com>

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