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

Re: Adding Missing Data to a Table

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: Postgresql PDX_Users <pdxpug(at)postgresql(dot)org>
Subject: Re: Adding Missing Data to a Table
Date: 2011-03-30 12:47:53
Message-ID: alpine.LNX.2.00.1103300542520.19520@salmo.appl-ecosys.com (view raw or flat)
Thread:
Lists: pdxpug
On Tue, 29 Mar 2011, Roderick A. Anderson wrote:

> A CAST should handle getting the data from the tmp_col back into record. 
> The serial was a simple way to get the column incrementally filled.

Rod,

   I need to read more about CAST. My understanding is it is used to change a
data type (e.g., casting a FLOAT to NUMERIC when selecting a decimal value
that cannot be exactly matched otherwise). I did not realize it could be
used to move values among columns.

> And it appears I got caught up in the solution and forgot the record
> column was (going to be?) coming with the data from this point on.  No
> need to create the SEQUENCE.  Just a UNIQUE INDEX will keep it all
> straight.

   Almost 1/3 of the rows already have values in the record column. I want to
replace the NULLs with values in the other two thirds so the column can be
used as a PK. Since the non-NULL rows are data from 2008-2009 it's a valid
assumption that data from 2010 and beyond will also have a value for this
attribute.

Thanks,

Rich

In response to

Responses

pdxpug by date

Next:From: Rich ShepardDate: 2011-04-01 15:31:19
Subject: Re: Adding Missing Data to a Table [SOLVED]
Previous:From: Roderick A. AndersonDate: 2011-03-30 04:43:45
Subject: Re: Adding Missing Data to a Table

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