X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 80186D1DD71 for ; Tue, 17 Feb 2004 16:31:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 29855-08 for ; Tue, 17 Feb 2004 12:31:56 -0400 (AST) Received: from serwer.skawsoft.com.pl (skawina.eu.org [80.48.213.66]) by svr1.postgresql.org (Postfix) with ESMTP id 33F99D1DAB0 for ; Tue, 17 Feb 2004 12:31:55 -0400 (AST) Received: from klaster.net (core-1.citynet.pl [80.48.135.14]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 1A2A92B3CB; Tue, 17 Feb 2004 17:31:36 +0100 (CET) Message-ID: <403242A6.4040302@klaster.net> Date: Tue, 17 Feb 2004 17:34:46 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.6) Gecko/20040113 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Karl Denninger Cc: pgsql-sql@postgresql.org Subject: Re: Ok, what am I doing wrong here? References: <20040217100250.A65968@Denninger.Net> In-Reply-To: <20040217100250.A65968@Denninger.Net> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/213 X-Sequence-Number: 16903 Dnia 2004-02-17 17:02, Użytkownik Karl Denninger napisał: > I want to insert values from one table into another, and add some "default" > values (that are not defaults on the table different reasons - that is, this > is maintenance function and in normal operation there would be "real" values > there - and null is valid) > > So, I want to do, for example, the following: > > insert into table (id, time, type) values (select id, now(), '1' from secondtable); Documentation says: INSERT INTO table [ ( column [, ...] ) ] { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) | SELECT query } insert into table (id, time, type) select id, now(), '1' from secondtable; Regards, Tomasz Myrta