pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Karl Denninger <karl@denninger.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Ok, what am I doing wrong here?
Date: Tue, 17 Feb 2004 17:34:46 +0100
Message-ID: <403242A6.4040302@klaster.net> (raw)
In-Reply-To: <20040217100250.A65968@Denninger.Net>
References: <20040217100250.A65968@Denninger.Net>

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



view thread (5+ messages)  latest in thread

Message-ID: <403242A6.4040302@klaster.net>
Permalink:  ../403242A6.4040302@klaster.net/
Also on:    postgresql.org/message-id/403242A6.4040302@klaster.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasiek@klaster.net, karl@denninger.net
  Subject: Re: Ok, what am I doing wrong here?
  In-Reply-To: <403242A6.4040302@klaster.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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