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

Re: Normalising an existing table - how?

From: Graham Leggett <minfrin(at)sharp(dot)fm>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Frank Bax <fbax(at)sympatico(dot)ca>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Normalising an existing table - how?
Date: 2004-06-25 09:57:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Richard Huxton wrote:

>> How would I put the primary key of each row in newtable back into 
>> oldtable? Also, newtable already exists and contains data - I need to 
>> add normalised data to an already partially normalised database.

> How can newtable contain data if you don't have any keys for it?
> Perhaps a fuller example, with the schemas of the tables in question 
> would help.

I have a system that keeps track of money. Part of the system's money 
handling is already normalised, in that there is a money table, 
containing information about the amount concerned, the amount of tax 
appropriate, the currency involved, etc. Part of the system is not 
normalised, in that a simple column in table contains the amount of 
money, but not the tax appropriate, nor the currency involved. My task 
is to fix this situation to make it consistent throughout.

Because the database is partially normalised, the money table already 
contains rows corresponding to the properly normalised part of the 
database. New rows need to be added on top of the existing rows, 
replacing the rest of the columns that need to be normalised. As a 
result, creating a new money table is not possible, as this table 
already exists.


In response to


pgsql-sql by date

Next:From: Richard HuxtonDate: 2004-06-25 10:18:53
Subject: Re: Normalising an existing table - how?
Previous:From: Oleg BartunovDate: 2004-06-25 09:38:22
Subject: Re: [GENERAL] tsearch2,pgsql 7.4.[1|2], pg_dump problem

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