Bug #754: Bug with inserts and rules on inserts in Postgres 7.2.1-3

Поиск
Список
Период
Сортировка
От pgsql-bugs@postgresql.org
Тема Bug #754: Bug with inserts and rules on inserts in Postgres 7.2.1-3
Дата
Msg-id 20020830162749.67CBF476ACC@postgresql.org
обсуждение исходный текст
Список pgsql-bugs
Paulo Santos (psantos@wit-software.com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Bug with inserts and rules on inserts in Postgres 7.2.1-3

Long Description
Hi!

I've a table (USERS) with three rules created.

What this rules does is to insert other values in an other table (FOLDERS). So when I create a user I insert three
(Inbox,Sent, and Base folder) default folders for this user. 

This rules use the new.user_id to the FK reference in the table folders to the table users.

I discover that if I insert using something like:
insert into users values (nextval('user_seq'), 'usera');
The rules will try to insert nextval('user_seq') as the FK insted of the value that the insert have.
So the insert in the users will get the id=1, and the three rules will have the ids: 2, 3 and 4 that don't exist in the
database.

So I can only insert data in the table users using this pseudo code:

int id = select nextval('user_seq');
insert into users (id, 'usera');

This is happening in Postgres 7.2.1-3

If you consider this a real bug and want further informations, please e-mail me and I'll explain this with more
details.

Best Regards,
Paulo Santos

Sample Code


No file was uploaded with this report

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Please, help me!
Следующее
От: "Tomoyuki Niijima"
Дата:
Сообщение: failed to build libpq.so on AIX 4 and 5/I have a solution