Re: Checking number of entries
От | Philip Warner |
---|---|
Тема | Re: Checking number of entries |
Дата | |
Msg-id | 3.0.5.32.20001001104529.02899660@mail.rhyme.com.au обсуждение исходный текст |
Ответ на | Re: Checking number of entries (Philip Warner <pjw@rhyme.com.au>) |
Ответы |
Re: Checking number of entries
|
Список | pgsql-general |
At 11:25 30/09/00 -0700, Stephan Szabo wrote: > >On Sat, 30 Sep 2000, Philip Warner wrote: > >> >> alter table zzz add constraint >> check( (select sum(zzzz.f1*zzz1.f1_1) from zzzz,zzz1 >> where zzzz.f2=zzz1.f1_1) + f1 > 0); >> >> Any updates to the referenced tables cause it to run a query that *seems* >> to be: >> >> select * from ZZZ where not ( <constraint-condition> ) >> > >Well, I'm not sure how easy/hard it is to get all referenced tables right >now, since you'd have to decend into subqueries. But, yeah, that seems >like it would probably work since you probably couldn't currently put >anything in the check constraint that would work there but not in a >subquery context (although i could be wrong about that). Yes; we'd need to generate a plan for the constraint, and find all the tables it references. Is that a hard thing to do? >Can you do arbitrary user functions in Dec RDB that access tables and put >those in constraints? I'm not sure what to do about the fact that we can't >actually get the referenced tables inside functions for some cases. RDB has two kinds of functions: external & SQL. External functions can't make data changes, or even easily read the database, and SQL functions are just pieces of (complex multi-line) SQL, that can be parsed like anything else. As a result, when you call a function in a constraint, it plans the function, and gets the list of tables. Also, RDB does allow non-deterministic constraints, but if someone is silly enough to use one, then so be it... ---------------------------------------------------------------- Philip Warner | __---_____ Albatross Consulting Pty. Ltd. |----/ - \ (A.B.N. 75 008 659 498) | /(@) ______---_ Tel: (+61) 0500 83 82 81 | _________ \ Fax: (+61) 0500 83 82 82 | ___________ | Http://www.rhyme.com.au | / \| | --________-- PGP key available upon request, | / and from pgp5.ai.mit.edu:11371 |/
В списке pgsql-general по дате отправления: