Re: Copying a column into a temp. table

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Subject: Re: Copying a column into a temp. table
Date: 2010-10-01 14:02:44
Message-ID: 201010010702.45053.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday 01 October 2010 6:54:09 am Alexander Farber wrote:
> How do you copy a column from table please?
> I'm trying with PostgreSQL 8.1.21/CentOS 5.5:
>
> # psql -a -f clean-forum.sql
> start transaction;
> START TRANSACTION
> create temp table old_topics (topic_id integer) on commit delete rows;
> CREATE TABLE
> create temp table old_posts (post_id integer) on commit delete rows;
> CREATE TABLE
> select topic_id from phpbb_topics where forum_id=5 and topic_poster=1
> and age(to_timestamp(topic_time))>interval '14 days' into old_topics;
> psql:clean-forum.sql:6: ERROR: syntax error at or near "into" at character
> 124 psql:clean-forum.sql:6: LINE 1: ...
> age(to_timestamp(topic_time))>interval '14 days' into old_t...
> psql:clean-forum.sql:6:
> ^
> commit
> ROLLBACK
>
> Of course "select ... into" doesn't work, but how should I do it?
> Can't find in http://www.postgresql.org/docs/8.1/static/
>
> Thank you
> Alex

http://www.postgresql.org/docs/8.1/interactive/sql-insert.html

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2010-10-01 14:04:18 Re: Optimizing postgresql.conf for dedicated windows server 2003 x64 standard edition
Previous Message Gabriele Bartolini 2010-10-01 13:57:39 Re: Copying a column into a temp. table