At 10:10 23/10/00 -0400, Tom Lane wrote:
>
>I consider that behavior *far* safer than allowing schema changes to
>be seen mid-transaction.  Consider the following example:
>
>       Session 1                       Session 2
>
>       begin;
>
>       INSERT INTO foo ...;
>
>                                       ALTER foo ADD constraint;
>
>       INSERT INTO foo ...;
>
>       end;
>
>Which, if any, of session 1's insertions will be subject to the
>constraint?  What are the odds that the dba will like the result?
>

In this case, wouldn't the answer depend on the isolation level of session
1? For serializable TX, then constraint would not apply; 'read committed'
would mean the constraint was visible on the second insert and at the commit.

I would err on the side of insisting all metadata changes occur in
serializable transactions to make life a little easier.


----------------------------------------------------------------
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   |/

Reply via email to