X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 84D3F9DCB38 for ; Sat, 25 Feb 2006 00:51:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64294-09 for ; Sat, 25 Feb 2006 00:51:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id 212479DCB0A for ; Sat, 25 Feb 2006 00:51:36 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k1P4pVH23469; Fri, 24 Feb 2006 23:51:31 -0500 (EST) From: Bruce Momjian Message-Id: <200602250451.k1P4pVH23469@candle.pha.pa.us> Subject: Re: CREATE TABLE AS and tablespaces In-Reply-To: <43FEE3AD.6080208@logix-tt.com> To: Markus Schaber Date: Fri, 24 Feb 2006 23:51:31 -0500 (EST) CC: PostgreSQL SQL List X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.389 required=5 tests=[AWL=-0.111, RAZOR2_CHECK=0.5] X-Spam-Score: 0.389 X-Spam-Level: X-Archive-Number: 200602/308 X-Sequence-Number: 24318 Markus Schaber wrote: > Hello, > > Recently, I wanted to create a table from a complex query in a specific > tablespace, but CREATE TABLE name AS SELECT ... does not accept a > tablespace argument. > > I worked around it by CREATE TABLE name AS SELECT ... LIMIT 0, then > moving the generated table to the other tablespace using ALTER TABLE, > and then using INSERT INTO ... SELECT to generate the data into the table. > > But nevertheless, I'd like to ask here whether there are specific > reasons for omitting the tablespace argument from the CREATE TABLE AS > statement. If not, I'd like to request this minor feature :-) > > Maybe it is even possible to further unify CREATE TABLE and CREATE TABLE AS. This feature will be in 8.2: revision 2.530 date: 2006/02/19 00:04:27; author: neilc; state: Exp; lines: +16 -20 Add TABLESPACE and ON COMMIT clauses to CREATE TABLE AS. ON COMMIT is required by the SQL standard, and TABLESPACE is useful functionality. Patch from Kris Jurka, minor editorialization by Neil Conway. -- Bruce Momjian http://candle.pha.pa.us SRA OSS, Inc. http://www.sraoss.com + If your life is a hard drive, Christ can be your backup. +