Re: Adding Missing Data to a Table

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pdxpug(at)postgresql(dot)org
Subject: Re: Adding Missing Data to a Table
Date: 2011-03-29 22:35:55
Message-ID: alpine.LNX.2.00.1103291532540.28359@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

On Tue, 29 Mar 2011, wes wrote:

> there are many options. One such is to find a column (or combination of
> columns) that has a unique value and use updates from a shell script.

Wes,

It would take a combination of at least three other columns to uniquely
identify each row.

> 'select unique_column[,some other column if needed] from table where record
> IS NULL;' > rows-to-update
> seq 30000 "$(wc -l rows-to-update)" > new-record-values

> I'm sure there are much better answers, but since all I have is a hammer,
> your problem looks suspiciously like a nail to me :)

Well, that's OK. If I'm going to select into a new table, I can do that by
selecting all rows where column named 'record' IS NULL, then apply the
sequence to that new table before recombining them.

You and Darrell have pointed me toward what I need to learn. Thank you
both very much.

Rich

In response to

Browse pdxpug by date

  From Date Subject
Next Message Rich Shepard 2011-03-29 22:37:33 Re: Adding Missing Data to a Table
Previous Message Rich Shepard 2011-03-29 22:32:37 Re: Adding Missing Data to a Table