pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sean Davis <sdavis2@mail.nih.gov>
To: bernard@bgsoftfactory.com
To: pgsql-sql@postgresql.org
Subject: Re: Newbie wonder...
Date: Sun, 13 Mar 2005 21:50:32 -0500
Message-ID: <003201c52840$97206db0$1f6df345@WATSON> (raw)
References: <1mmif8pua8zxb.q7qw4hme6jk5.dlg@40tude.net>

Bernard,

If you are simply doing a one-time convert of an old database schema to a 
new one, simply load the old tables into postgres and then use SQL commands 
to insert the data into the new tables.  For a sequence on the "existing 
table," you can do as above and load the old table or just use copy with the 
column names of all columns except the column with the serial values--these 
will be auto-incremented.

Sean

----- Original Message ----- 
From: "Bernard Grosperrin" <bernard@bgsoftfactory.com>
To: <pgsql-sql@postgresql.org>
Sent: Tuesday, March 08, 2005 6:25 PM
Subject: [SQL] Newbie wonder...


> Please, bear with me, as this is my first post here.
>
> (1) I have a 2 table database, result of a conversion from Access. This 
> has
> been made by an amateur, as one of the tables should be at least 3 related
> tables, bunch of redundant data,and the other one 2.
>
> I know I could create a table as the result of a request, so that I could
> isolate these redundant data, but what I don't know is how I would in the
> same time update the original table to put the ID of the matching ROW
> number in the newly created table, instead of the redundant data ?
>
> Should I create a stored procedure for that, and if yes, how ? Or should I
> do that in 2 passes, sequentially ?
>
> (2) How should I go to create a sequence for an existing table? For all
> futures data entry, after this conversion, I want the unique ID for each
> row to come from a sequence, but if I know how to create a table using
> serial, I am not sure how to modify one for this.
>
> Thanks,
> Bernard
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>               http://archives.postgresql.org
> 





view thread (4+ messages)  latest in thread

Message-ID: <003201c52840$97206db0$1f6df345@WATSON>
Permalink:  ../003201c52840$97206db0$1f6df345@WATSON/
Also on:    postgresql.org/message-id/003201c52840$97206db0$1f6df345@WATSON

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sdavis2@mail.nih.gov, bernard@bgsoftfactory.com
  Subject: Re: Newbie wonder...
  In-Reply-To: <003201c52840$97206db0$1f6df345@WATSON>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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