| От | Tom Lane |
|---|---|
| Тема | Re: plpgsql question: inserting records |
| Дата | |
| Msg-id | 24837.1193426189@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | plpgsql question: inserting records (Brian Hurt <bhurt@janestcapital.com>) |
| Список | pgsql-novice |
Brian Hurt <bhurt@janestcapital.com> writes:
> There has to be an easy way to do this and I'm just being stupid and
> missing it. What I want to do is, in plpgsql, insert a record (of the
> right type) into a table without having to list all the columns of the
> table. For example, I'd like to do:
Some experimentation says that "VALUES(t_rec.*)" will work as long as
t_rec is declared as the table's rowtype, and not generic "record".
(I didn't try it further back than 8.1 though.)
For future-proofing purposes I'd advise spelling it with extra
parentheses: VALUES((t_rec).*). It doesn't matter right now but
might someday.
regards, tom lane
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера