Hi guys,

Messing about with ADD COLUMN...

I'm not certain how to re-evaluate the default expression for each row?  How
do I do this?  I have access to raw_default and cooked_default it seems.

Thanks,

Chris


Thu, 5 Dec 2002 13:24:08 -0800
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
Quick Help
It works very similarly to the way that ALTER TABLE ... ADD CHECK ..
works, with the tuple update added in.

Anyway, it's something like the below:

- Lock relation
- Pull out tuple
- Evaluate cooked default expression using EvalExpr
- heap_modifytuple (shove datum that EvalExpr returns into column)
- simple_heapupdate
- Goto step 2 (pull out next tuple)



On Thu, 2002-12-05 at 16:24, Christopher Kings-Lynne wrote:
> Hi guys,
> 
> Messing about with ADD COLUMN...
> 
> I'm not certain how to re-evaluate the default expression for each row?  How
> do I do this?  I have access to raw_default and cooked_default it seems.
> 
> Thanks,
> 
> Chris
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
-- 
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc
05 Dec 2002 19:20:29 -0500
Rod Taylor <rbt@rbt.ca>
Re: Quick Help
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> Messing about with ADD COLUMN...

> I'm not certain how to re-evaluate the default expression for each
> row?

Basically you'll want to apply ExecEvalExpr (or perhaps
ExecEvalExprSwitchContext) to the "cooked" expression tree.
Look at the execution of per-row constraints in ADD CONSTRAINT;
should be very very similar.

			regards, tom lane

Fri, 06 Dec 2002 16:34:21 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Quick Help 