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 17522D1DD71 for ; Tue, 17 Feb 2004 16:25:10 +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 29455-03 for ; Tue, 17 Feb 2004 12:25:04 -0400 (AST) Received: from ganymede.hub.org (u46n208.hfx.eastlink.ca [24.222.46.208]) by svr1.postgresql.org (Postfix) with ESMTP id 3E18DD1DCD9 for ; Tue, 17 Feb 2004 12:25:03 -0400 (AST) Received: by ganymede.hub.org (Postfix, from userid 1000) id 7422A39764; Tue, 17 Feb 2004 12:20:58 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 732E439699; Tue, 17 Feb 2004 12:20:58 -0400 (AST) Date: Tue, 17 Feb 2004 12:20:58 -0400 (AST) From: "Marc G. Fournier" X-X-Sender: scrappy@ganymede.hub.org To: Karl Denninger Cc: pgsql-sql@postgresql.org Subject: Re: Ok, what am I doing wrong here? In-Reply-To: <20040217100250.A65968@Denninger.Net> Message-ID: <20040217122000.X94474@ganymede.hub.org> References: <20040217100250.A65968@Denninger.Net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/211 X-Sequence-Number: 16901 On Tue, 17 Feb 2004, Karl Denninger wrote: > 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); > > Postgres's command line pukes on this, complaining that "select" is invalid > inside the values part of the definition. > > SQL's language specification says otherwise, as does "\h insert" from the > command line. > > The query stand-alone returns a table with values that are valid for the > table I wish to insert into. > > Where's my brain-fade on this? INSERT INTO table (id, time, type) SELECT id, now(), '1' FROM secondtable; ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664