Skip site navigation (1) Skip section navigation (2)

Re: pg_dump only certain rows

From: "Anthony E (dot) Greene" <agreene(at)pobox(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: pg_dump only certain rows
Date: 2001-02-10 23:18:17
Message-ID: 20010210181817.E8182@cp5340 (view raw or flat)
Thread:
Lists: pgsql-novice
On Sat, 10 Feb 2001 16:11:00 Stefan Waidele jun. wrote:
>I want to normalize an existing table.
>
>Is there a way to drop the unwanted columns in my original table?
>
>SQL-alter does not seem to do it, neither can I specify the columns used in
>
>pd_dump. Or have I overlooked something?

Select the rows and columns you want directly into a new table, then drop
the old table:

SELECT column1,column2 INTO new_table FROM old_table WHERE
filter_conditions;

Tony
-- 
Anthony E. Greene <agreene(at)pobox(dot)com> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
Chat:  AOL/Yahoo: TonyG05    ICQ: 91183266
Linux. The choice of a GNU Generation. <http://www.linux.org/>

In response to

pgsql-novice by date

Next:From: Andy ArledgeDate: 2001-02-12 04:50:16
Subject: novice, question
Previous:From: Stefan Waidele jun.Date: 2001-02-10 21:11:00
Subject: pg_dump only certain rows

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group