Re: [HACKERS] Re: ALTER TABLE DROP COLUMN

Jan Wieck <wieck@debis.com>

From: wieck@debis.com (Jan Wieck)
To: Hannu Krosing <hannu@tm.ee>
Cc: Don Baccus <dhogaza@pacifier.com>, Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL Development <pgsql-hackers@postgreSQL.org>
Date: 2000-02-29T00:43:17Z
Lists: pgsql-hackers
Hannu Krosing wrote:

> Don Baccus wrote:
>
> > donb=# update foo set i=i+1;
> > ERROR:  Cannot insert a duplicate key into unique index foo_pkey
>
> IIRC, the same behaviour plagued the old foreign key implementation
> in contrib, which was why it was refused for a long time to be
> integrated.
>
> I hope that at least the foreig keys don't do it anymore.

    ALL  the  FK  triggers  are  delayed  until  after the entire
    statement (what's wrong for ON DELETE RESTRICT -  but  that's
    another  story), or until the entire transaction (in deferred
    mode).

    But the UNIQUE constraint is still built upon  unique  nbtree
    indices,  thus  failing  on  primary  key where such a unique
    index is automatically created for.

    I'm far too less familiar with our implementation  of  nbtree
    to  tell  whether it would be possible at all to delay unique
    checking until statement end  or  XACT  commit.  At  least  I
    assume  it  would  require some similar technique of deferred
    queue.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #