Re: Dynamic prepare possible in plpgsql?
| От | Jim Nasby |
|---|---|
| Тема | Re: Dynamic prepare possible in plpgsql? |
| Дата | |
| Msg-id | 6960BD9A-8B30-4906-ACA2-7ACF5DAD02C0@decibel.org обсуждение исходный текст |
| Ответ на | Re: Dynamic prepare possible in plpgsql? ("Jonah H. Harris" <jonah.harris@gmail.com>) |
| Список | 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 по дате отправления: