Re: Tips for re-using function results within single insert
В списке pgsql-general по дате отправления:
| От | Richard Huxton |
|---|---|
| Тема | Re: Tips for re-using function results within single insert |
| Дата | |
| Msg-id | 200209231245.32139.dev@archonet.com обсуждение исходный текст |
| Ответ на | Tips for re-using function results within single insert (Chris Gamache <cgg007@yahoo.com>) |
| Ответы |
Re: Tips for re-using function results within single insert
|
| Список | pgsql-general |
On Friday 20 Sep 2002 5:52 pm, Chris Gamache wrote:
> This would be nice to be able to do...
>
> insert into test_table (a,b) select random()::text as "myrandom",
> encode("myrandom",'base64');
Well, I'd be tempted to write a wrapper function tagged as "iscachable" and
call it with a parameter of the current transaction-id (see docs on trigger
functions) or current time (the one from now() which doesn't change per
transaction). If this gives you grief, try a standard constant.
This means PG will cache results as long as the parameter doesn't change, in
this case for the duration of the transaction.
HTH
- Richard Huxton
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера