Re: Assertions in PL/PgSQL

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Assertions in PL/PgSQL
Дата
Msg-id CAFj8pRCjQ_jKJxD2VWzNvRU+KUMA5ob03YSeWWXx6L0i1pfjiw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Assertions in PL/PgSQL  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Assertions in PL/PgSQL  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers
<p dir="ltr"><br /> Dne 14. 9. 2013 23:55 "Pavel Stehule" <<a
href="mailto:pavel.stehule@gmail.com">pavel.stehule@gmail.com</a>>napsal(a):<br /> ><br /> ><br /> > Dne
14.9. 2013 23:35 "Marko Tiikkaja" <<a href="mailto:marko@joh.to">marko@joh.to</a>> napsal(a):<br /> ><br />
>><br /> > > On 2013-09-14 23:05, Pavel Stehule wrote:<br /> > >><br /> > >> A some
languageshas a generic PRAGMA keyword. So I would be much more<br /> > >> happy with something like<br /> >
>><br/> > >> PRAGMA Assert(found);<br /> > >><br /> > >> It is much more close to ADA,
andit allows a reuse of new keyword for any<br /> > >> other usage in future (your proposal is too simply,
withoutpossibility<br /> > >> open new doors in future). And we can define a some standard predefined<br />
>>> asserts too - like Assert, AssertNotNull, AssertNotEmpty, ...<br /> > ><br /> > ><br /> >
>I don't see why e.g. PRAGMA AssertNotEmpty(foo);  would be better than ASSERT NotEmpty(foo);  and the NotNull
versionis even sillier considering the expression is arbitrary SQL, and we'd have to do all kinds of different versions
orpeople would be disappointed (AssertNull, AssertNotNull, AssertExists, AssertNotExists, etc.).<br /> > ><br />
>> I see what you're trying to do, but I don't think crippling new features just because we might do something
similarat some point is a good idea.  I'm guessing this is what happened with the row_count syntax, which made the
featurean absolute nightmare to use.<br /> ><br /> > a more than one asserts can be my personal preferrence (it
isnot important).<br /> ><br /> > but introduction a reserved keword for one very special purpose (without
extensibility)is not prudent.<br /> ><br /> > plpgsql has still lot of relations to pl/sql and ada, and I don't
thinkso we have to introduce a new original syntax everytime<p dir="ltr">this is a possibility for introduction a new
hookand possibility implement asserions and similar task in generic form (as extension). it can be assertions, tracing,
profiling.<pdir="ltr">I like a integrated assertions, but I would not close a door to future enhancing (probably there
willnot be a possibility intriduce a new keyword for tracing - although I would to implement a difference between
developmentan production usage.<p dir="ltr">so I am against to your proposal - it doesn't allow any extensibility. <p
dir="ltr">><br /> > >> other issue - A asserts macros has one or two parameters usually. You<br /> >
>>should to support two params assert (with message).<br /> > ><br /> > ><br /> > > That I
thinkis worth looking into.<br /> > ><br /> > ><br /> > > Regards,<br /> > > Marko Tiikkaja<br
/>

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Marko Tiikkaja
Дата:
Сообщение: Re: Assertions in PL/PgSQL
Следующее
От: Andres Freund
Дата:
Сообщение: Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE