From: | Jim Nasby <decibel(at)decibel(dot)org> |
---|---|
To: | Jonah H(dot) Harris <jonah(dot)harris(at)gmail(dot)com> |
Cc: | "Collin Peters" <cadiolis(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Dynamic prepare possible in plpgsql? |
Date: | 2007-05-07 16:58:15 |
Message-ID: | 6960BD9A-8B30-4906-ACA2-7ACF5DAD02C0@decibel.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On May 1, 2007, at 12:16 PM, Jonah H. Harris wrote:
> On 5/1/07, Collin Peters <cadiolis(at)gmail(dot)com> wrote:
>> Is it faster to use PREPARE for the various INSERT statements
>> inside a
>> plpgsql function? Perhaps I am wrong and it does its PREPARE work
>> when the function is parsed.
>
> IIRC, PLpgSQL automagically prepares each statement behind the scenes
> on the first use.
BTW, a good use for a version of EXECUTE that accepted parameters is
the trigger on a partitioned table to direct inserts to the
appropriate partition. Currently, you have to quote_literal(coalesce
(NEW.field, 'NULL')) in the dynamic statement.
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)
From | Date | Subject | |
---|---|---|---|
Next Message | Rommel the iCeMAn | 2007-05-07 23:17:09 | Error: Input string was not in a correct format |
Previous Message | Aaron Bono | 2007-05-07 16:40:19 | Re: Sequence vs. Index Scan |