ALTER TABLE RENAME fix

Поиск
Список
Период
Сортировка
От Brent Verner
Тема ALTER TABLE RENAME fix
Дата
Msg-id 20011110055817.A69633@rcfile.org
обсуждение исходный текст
Ответы Re: ALTER TABLE RENAME fix  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: ALTER TABLE RENAME fix  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-patches
These patches fix the problem where an

  ALTER TABLE <table> RENAME <oldcolumn> TO <newcolumn>

did not update the RI_ triggers if the oldcolumn was referenced in
a RI constraint. The net effect of these patches is that the following
sql now works.

  create table parent (id int UNIQUE);
  create table child (id int references parent(id) on update cascade);
  alter table parent rename id to hello;
  insert into parent values(1);
  insert into child values(1);


The first patch (pgsql-1.diff) moves the defines for the RI_ function
args to an include, instead of just being local definitions.  It also
changes the name of one of the defines and adds another define so that
all function args in the pg_trigger.tgargs bytea are #defined.

The second patch (pgsql-2.diff) adds a function update_trigger_tgargs().
See comments in the file for explanation.  This code could /really/ use
a sanity check by someone with more C-foo than I have, to make sure I'm
not doing anything blatantly wrong.  Also, I'm directly creating a
varlena type, which I'm a bit uncomfortable with, so if there is a
utility to create these (without creating a char* for use with
byteain()), I'd appreciate you pointing me towards that, and I'll
resubmit a better patch.

I have not exhaustively tested this code, but everything I've thrown
at it does the right thing, and no regression failures are caused.

I'll work on regression tests after some sleep ;-)

cheers.
  brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

Вложения

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

Предыдущее
От: Klaus Naumann
Дата:
Сообщение: Re: Patch for Makefile race against current cvs
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ALTER TABLE RENAME fix