Tips for re-using function results within single insert

From: Chris Gamache <cgg007(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Tips for re-using function results within single insert
Date: 2002-09-20 16:52:01
Message-ID: 20020920165201.85115.qmail@web13806.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Elaine Lindelef 2002-09-20 18:12:11 Re: PHP + PostgreSQL
Previous Message Bruce Momjian 2002-09-20 16:19:04 Re: Monitoring a Query