pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
select into...
6+ messages / 4 participants
[nested] [flat]

* select into...
@ 2009-03-16 23:08 Tena Sakai <tsakai@gallo.ucsf.edu>
  2009-03-16 23:12 ` Re: select into... Scott Marlowe <scott.marlowe@gmail.com>
  2009-03-16 23:13 ` Re: select into... Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2009-03-16 23:13 ` Re: select into... Fernando Arancibia <farancibia@iswitch.cl>
  0 siblings, 3 replies; 6+ messages in thread

From: Tena Sakai @ 2009-03-16 23:08 UTC (permalink / raw)
  To: pgsql-admin

Hi Everybody,

I want to execute a query below:

  select *
    into my_table
    from old_table
   where (some_condition);

The trouble is that the manual page states that this would
"SELECT INTO creates a new table and fills it with data
computed by a query."

What I want is to append my_table.  Is there any way to
get postgres to do what I want done?

Thank you in advance.

Regards,

Tena Sakai
tsakai@gallo.ucsf.edu

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: select into...
  2009-03-16 23:08 select into... Tena Sakai <tsakai@gallo.ucsf.edu>
@ 2009-03-16 23:12 ` Scott Marlowe <scott.marlowe@gmail.com>
  2009-03-16 23:16   ` Re: select into... Tena Sakai <tsakai@gallo.ucsf.edu>
  2 siblings, 1 reply; 6+ messages in thread

From: Scott Marlowe @ 2009-03-16 23:12 UTC (permalink / raw)
  To: Tena Sakai <tsakai@gallo.ucsf.edu>; +Cc: pgsql-admin

On Mon, Mar 16, 2009 at 5:08 PM, Tena Sakai <tsakai@gallo.ucsf.edu> wrote:
> Hi Everybody,
>
> I want to execute a query below:
>
>   select *
>     into my_table
>     from old_table
>    where (some_condition);
>
> The trouble is that the manual page states that this would
> "SELECT INTO creates a new table and fills it with data
> computed by a query."
>
> What I want is to append my_table.  Is there any way to
> get postgres to do what I want done?

You want insert:

insert into my_table select yada from old_table;



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: select into...
  2009-03-16 23:08 select into... Tena Sakai <tsakai@gallo.ucsf.edu>
  2009-03-16 23:12 ` Re: select into... Scott Marlowe <scott.marlowe@gmail.com>
@ 2009-03-16 23:16   ` Tena Sakai <tsakai@gallo.ucsf.edu>
  0 siblings, 0 replies; 6+ messages in thread

From: Tena Sakai @ 2009-03-16 23:16 UTC (permalink / raw)
  To: Scott Marlowe <scott.marlowe@gmail.com>; +Cc: pgsql-admin

Many thanks, Scott.

Tena Sakai


-----Original Message-----
From: Scott Marlowe [mailto:scott.marlowe@gmail.com]
Sent: Mon 3/16/2009 4:12 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] select into...
 
On Mon, Mar 16, 2009 at 5:08 PM, Tena Sakai <tsakai@gallo.ucsf.edu> wrote:
> Hi Everybody,
>
> I want to execute a query below:
>
>   select *
>     into my_table
>     from old_table
>    where (some_condition);
>
> The trouble is that the manual page states that this would
> "SELECT INTO creates a new table and fills it with data
> computed by a query."
>
> What I want is to append my_table.  Is there any way to
> get postgres to do what I want done?

You want insert:

insert into my_table select yada from old_table;

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: select into...
  2009-03-16 23:08 select into... Tena Sakai <tsakai@gallo.ucsf.edu>
@ 2009-03-16 23:13 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2 siblings, 0 replies; 6+ messages in thread

From: Kevin Grittner @ 2009-03-16 23:13 UTC (permalink / raw)
  To: Tena Sakai <tsakai@gallo.ucsf.edu>; pgsql-admin

>>> "Tena Sakai" <tsakai@gallo.ucsf.edu> wrote: 
> What I want is to append my_table.  Is there any way
> to get postgres to do what I want done?
 
PostgreSQL supports the SQL standard syntax for this:
 
insert into my_table
  select *
    from old_table
    where (some_condition);
 
-Kevin



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: select into...
  2009-03-16 23:08 select into... Tena Sakai <tsakai@gallo.ucsf.edu>
@ 2009-03-16 23:13 ` Fernando Arancibia <farancibia@iswitch.cl>
  2009-03-16 23:31   ` Re: select into... Tena Sakai <tsakai@gallo.ucsf.edu>
  2 siblings, 1 reply; 6+ messages in thread

From: Fernando Arancibia @ 2009-03-16 23:13 UTC (permalink / raw)
  To: Tena Sakai <tsakai@gallo.ucsf.edu>; +Cc: pgsql-admin

Hi, try
insert into my_table select * from old_table where (some_condition);

bye
Fernando.

2009/3/16 Tena Sakai <tsakai@gallo.ucsf.edu>

>  Hi Everybody,
>
> I want to execute a query below:
>
>   select *
>     into my_table
>     from old_table
>    where (some_condition);
>
> The trouble is that the manual page states that this would
> "SELECT INTO creates a new table and fills it with data
> computed by a query."
>
> What I want is to append my_table.  Is there any way to
> get postgres to do what I want done?
>
> Thank you in advance.
>
> Regards,
>
> Tena Sakai
> tsakai@gallo.ucsf.edu
>
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: select into...
  2009-03-16 23:08 select into... Tena Sakai <tsakai@gallo.ucsf.edu>
  2009-03-16 23:13 ` Re: select into... Fernando Arancibia <farancibia@iswitch.cl>
@ 2009-03-16 23:31   ` Tena Sakai <tsakai@gallo.ucsf.edu>
  0 siblings, 0 replies; 6+ messages in thread

From: Tena Sakai @ 2009-03-16 23:31 UTC (permalink / raw)
  To: Fernando Arancibia <farancibia@iswitch.cl>; +Cc: pgsql-admin

Thank you, Fernando.
Thank you, Kevin.

Regards,

Tena Sakai
tsakai@gallo.ucsf.edu


-----Original Message-----
From: Fernando Arancibia [mailto:farancibia@iswitch.cl]
Sent: Mon 3/16/2009 4:13 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] select into...
 
Hi, try
insert into my_table select * from old_table where (some_condition);

bye
Fernando.

2009/3/16 Tena Sakai <tsakai@gallo.ucsf.edu>

>  Hi Everybody,
>
> I want to execute a query below:
>
>   select *
>     into my_table
>     from old_table
>    where (some_condition);
>
> The trouble is that the manual page states that this would
> "SELECT INTO creates a new table and fills it with data
> computed by a query."
>
> What I want is to append my_table.  Is there any way to
> get postgres to do what I want done?
>
> Thank you in advance.
>
> Regards,
>
> Tena Sakai
> tsakai@gallo.ucsf.edu
>
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2009-03-16 23:31 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-03-16 23:08 select into... Tena Sakai <tsakai@gallo.ucsf.edu>
2009-03-16 23:12 ` Scott Marlowe <scott.marlowe@gmail.com>
2009-03-16 23:16   ` Tena Sakai <tsakai@gallo.ucsf.edu>
2009-03-16 23:13 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2009-03-16 23:13 ` Fernando Arancibia <farancibia@iswitch.cl>
2009-03-16 23:31   ` Tena Sakai <tsakai@gallo.ucsf.edu>

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