Re: Dynamic prepare possible in plpgsql? - Mailing list pgsql-sql

From Jim Nasby
Subject Re: Dynamic prepare possible in plpgsql?
Date
Msg-id 6960BD9A-8B30-4906-ACA2-7ACF5DAD02C0@decibel.org
Whole thread Raw
In response to Re: Dynamic prepare possible in plpgsql?  ("Jonah H. Harris" <jonah.harris@gmail.com>)
List pgsql-sql
On May 1, 2007, at 12:16 PM, Jonah H. Harris wrote:
> On 5/1/07, Collin Peters <cadiolis@gmail.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@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)




pgsql-sql by date:

Previous
From: "Aaron Bono"
Date:
Subject: Re: Sequence vs. Index Scan
Next
From: "Rommel the iCeMAn"
Date:
Subject: Error: Input string was not in a correct format