| От | Tom Lane |
|---|---|
| Тема | Re: Function Question |
| Дата | |
| Msg-id | 14383.1323400583@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Function Question (Jake Stride <jake@stride.me.uk>) |
| Список | pgsql-general |
Jake Stride <jake@stride.me.uk> writes:
> I am trying to create a function that gets fired when a new row is
> inserted. I can get the following function built but my problem is
> that the sequence that is created is called "NEW.key" rather than the
> value that is being inserted (it should be a UUID).
Instead of this:
> CREATE SEQUENCE \"NEW.key\";
you need to do something like this:
EXECUTE 'CREATE SEQUENCE ' || quote_ident(NEW.key);
The reason is that utility statements don't accept parameters natively,
so you have to construct the command as a string and then EXECUTE it.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера