Re: quoting and EXECUTE in plpgsql function
От | Doug McNaught |
---|---|
Тема | Re: quoting and EXECUTE in plpgsql function |
Дата | |
Msg-id | m3wunu2h8g.fsf@varsoon.wireboard.com обсуждение исходный текст |
Ответ на | quoting and EXECUTE in plpgsql function ("Matthew Nuzum" <cobalt@bearfruit.org>) |
Список | pgsql-general |
"Matthew Nuzum" <cobalt@bearfruit.org> writes: > Hello, I'm writing my first large plpgsql function and I'm having a > little difficulty. > > First, let me say that I'm editing my function through phpPgAdmin, and I > believe that it requires you to escape all single quotes when entering > functions. I'm not sure if that is also true when creating a function > using the command line tools. Yes. > EXECUTE '' INSERT INTO raw_data '' || Any reason you're using EXECUTE here? EXECUTE is really only needed when the table or column names need to be determined at runtime. Your query looks quite normal, so you don't need to use EXECUTE. As a bonus, the query will get compiled and the plan saved so you won't be calling the planner for every row you insert. Second, I don't think you need quote_ident, especially if you're not using EXECUTE. You should just be able to do something like: INSERT INTO foo_table (bar, baz, quux) VALUES (bar, baz, quux); (assuming bar, baz and quux are aliased in your declaration section. Give that a try. -Doug
В списке pgsql-general по дате отправления: