| From: | Karl Denninger <karl(at)denninger(dot)net> |
|---|---|
| To: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Ok, what am I doing wrong here? |
| Date: | 2004-02-17 16:58:00 |
| Message-ID: | 20040217105800.A66571@Denninger.Net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Thanks...
--
--
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!
On Tue, Feb 17, 2004 at 08:29:06AM -0800, Stephan Szabo wrote:
> sszabo(at)bigpanda(dot)com
>
> 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.
>
> I think what you want is
> insert into table (id, time, type) select id, now(), '1' from secondtable;
>
> The choices allowed right now are default values, something that is
> basically a row constructor with values [*] or a query.
>
> [*] - The full spec allows a list of row constructors but we don't
> currently.
>
>
>
> %SPAMBLOCK-SYS: Matched [(at)postgresql(dot)org], message ok
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jeremy Smith | 2004-02-17 17:00:33 | Re: bytea or blobs? |
| Previous Message | Tomasz Myrta | 2004-02-17 16:34:46 | Re: Ok, what am I doing wrong here? |