Re: Cursor bug?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: "Mike G(dot)" <mike(at)thegodshalls(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Cursor bug?
Date: 2005-01-14 12:28:47
Message-ID: 20050114122842.GA1724@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 13, 2005 at 04:35:04PM -0600, Mike G. wrote:
> thank you.
>
> I use the cursor because I really do an update against a different
> table based on a value from the select in the original table. I am
> eagerly awaiting 8.0 and the ability to issue an Update Table1 Set
> Table1.col = Table2.col Using (Select y from Table2)

What's this USING keyword you're referring to, I can't find it in the
documentation anywhere, what does it do?

Beside, it's seems to me your entire function could be replaced by a
single query:

insert into temp_tables.delete_me
select name, file_number, question_to_change,
new_result, email
from source_table
where question_to_change = 'consultant'
and file_number is not NULL;

or something like that, i didn't check the schema. But this is probably
a cut down version. Tom's suggestion to use a FOR IN SELECT loop is a
good one.

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2005-01-14 12:30:34 Re: Insufficient system resources for PostgreSQL 7.4.x?
Previous Message Alban Hertroys 2005-01-14 12:27:24 Re: pl/pgsql trigger: syntax error at or near "ELSEIF"