Re: PL/pgSQL 2
От | Kevin Grittner |
---|---|
Тема | Re: PL/pgSQL 2 |
Дата | |
Msg-id | 1409663579.59999.YahooMailNeo@web122305.mail.ne1.yahoo.com обсуждение исходный текст |
Ответ на | PL/pgSQL 2 (Joel Jacobson <joel@trustly.com>) |
Ответы |
Re: PL/pgSQL 2
|
Список | pgsql-hackers |
Joel Jacobson <joel@trustly.com> wrote: > + Make UPDATE/INSERT/DELETE throw error if they didnt' modify > exactly 1 row, as that's the most common use-case, and provide > alternative syntax to modify multiple or zero rows. I just embarked on wading through the 99 messages (so far) on this thread, so my apologies if this has already been addressed -- but I wanted to register a strong objection to making this the default in any rewrite. If we want to support a setting or a statement option for it, fine; but in my personal experience in a production environment with thousands of plpgsql functions, most functions written to deal with one row at a time were orders of magnitude slower than they needed to be -- I spent a lot of my time rewriting them to use set logic so that they could benefit from the optimizer's attention. Getting people to write things in a declarative style in the first place was difficult because so many of the programmers were so attached to the imperative style of coding; making it more difficult for people to Do The Right Thing is a bad idea IMO. As a side note, of the many times I rewrote long functions which looped through individual rows, I would estimate that 80% of them had subtle bugs which were fixed by changing them to set logic. Sure, some of those would have caused run-time errors rather than plausible-but-incorrect results with the change you suggest, but far from all of them. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: