Re: proposal: plpgsql - Assert statement
От | Jim Nasby |
---|---|
Тема | Re: proposal: plpgsql - Assert statement |
Дата | |
Msg-id | 542A1DAF.2000101@nasby.net обсуждение исходный текст |
Ответ на | Re: proposal: plpgsql - Assert statement (Jan Wieck <jan@wi3ck.info>) |
Ответы |
Re: proposal: plpgsql - Assert statement
|
Список | pgsql-hackers |
On 9/17/14, 7:40 PM, Jan Wieck wrote: > Exactly. Doing something like > > ASSERT (select count(*) from foo > where fk not in (select pk from bar)) = 0; > > is a perfectly fine, arbitrary boolean expression. It will probably work well in a development environment too. And I amvery sure that it will not scale well once that code gets deployed. And I know how DBAs react to the guaranteed followingperformance problem. They will disable ALL assert ... or was there some sort of assert class system proposed thatI missed? Keep in mind that nothing we come up with will be immune to abuse, and trying to solve what is fundamentally an educationproblem through technology rarely turns out well. We're also putting too much weight on the term "assert" here. C-style asserts are generally not nearly as useful in a databaseas general sanity-checking or error handling, especially if you're trying to use the database to enforce data sanity. My wish-list for "asserts" is: - Works at a SQL level - Unique/clear way to identify asserts (so you're not guessing where the assert came from) - Allows for over-riding individual asserts (so if you need to do something you're "not supposed to do" you still have theprotection of all other asserts) - Less verbose than IF THEN RAISE END IF -- Jim C. Nasby, Data Architect jim@nasby.net 512.569.9461 (cell) http://jim.nasby.net
В списке pgsql-hackers по дате отправления: