From: | BladeOfLight16 <bladeoflight16(at)gmail(dot)com> |
---|---|
To: | Robert James <srobertjames(at)gmail(dot)com> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Column names for INSERT with query |
Date: | 2013-08-23 05:47:02 |
Message-ID: | CA+=1U=VmT8KjEhfgHkxdgJuckmcyLfsEAerC_cSWqAo7UY=P2g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Aug 22, 2013 at 6:36 PM, Ian Lawrence Barwick <barwick(at)gmail(dot)com>wrote:
> INSERT INTO t (t_field1, t_field2, t_field3)
> SELECT r.field1, r.field2, (x+y)
> FROM r
>
Obligatory link to documentation:
http://www.postgresql.org/docs/9.2/static/sql-insert.html. See where it
says [ ( *column_name* [, ...] ) ]? The square brackets mean "optional",
and the ",..." means repeat as needed. The fact "column_name" is italics
tell you it's some kind of variable text you should replace, and later on
in the page explains what goes there. So it's telling you that you can use
a comma separated list of column names from the destination table.
PostgreSQL has some of the best documentation of any software I've ever
seen. Don't hesitate to check it often when working.
From | Date | Subject | |
---|---|---|---|
Next Message | Vincent Veyron | 2013-08-23 08:58:58 | Re: Locale Issue |
Previous Message | Michael Paquier | 2013-08-23 04:07:55 | Re: Temp files on Commit |