Tips for re-using function results within single insert - Mailing list pgsql-general

From Chris Gamache
Subject Tips for re-using function results within single insert
Date
Msg-id 20020920165201.85115.qmail@web13806.mail.yahoo.com
Whole thread Raw
Responses Re: Tips for re-using function results within single insert  (Richard Huxton <dev@archonet.com>)
List pgsql-general
using this table:
create table test_table (a text, b text);

This would be nice to be able to do...

insert into test_table (a,b) select random()::text as "myrandom",
  encode("myrandom",'base64');


Any ideas on how to accomplish this without

create table test_table (id serial, a text, b text);

insert into test_table (a) values (random()::text);
update test_table set b=encode(a,'base64') where id = currval('id_seq');

CG


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Data Dump Issue
Next
From: Bruce Momjian
Date:
Subject: Re: Monitoring a Query