Ok, what am I doing wrong here?

From: Karl Denninger <karl(at)denninger(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Ok, what am I doing wrong here?
Date: 2004-02-17 16:02:50
Message-ID: 20040217100250.A65968@Denninger.Net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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?

--
--
Karl Denninger (karl(at)denninger(dot)net) Internet Consultant & Kids Rights Activist
http://www.denninger.net Tired of spam at your company? LOOK HERE!
http://childrens-justice.org Working for family and children's rights
http://diversunion.org LOG IN AND GET YOUR TANK STICKERS TODAY!
http://scubaforum.org Come talk about DIVING!

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Marc G. Fournier 2004-02-17 16:20:58 Re: Ok, what am I doing wrong here?
Previous Message Jan Wieck 2004-02-17 15:08:25 Re: bytea or blobs?