Unexpected behaviour of 'DEFERRABLE INITIALLY DEFERRED'
От | Jong-won Choi |
---|---|
Тема | Unexpected behaviour of 'DEFERRABLE INITIALLY DEFERRED' |
Дата | |
Msg-id | 5655AA70.5080709@internode.on.net обсуждение исходный текст |
Ответы |
Re: Unexpected behaviour of 'DEFERRABLE INITIALLY DEFERRED'
|
Список | pgsql-general |
Hi all, This is from my local PostgreSQL log: ==== LOG: statement: begin; LOG: statement: INSERT INTO site_owner (email, name, pwhash, data) VALUES ('xyz', 'xyz', crypt('xyz', gen_salt('bf', 8)), '{}'::JSONB) RETURNING id; LOG: statement: INSERT INTO site (owner, name, timezone, data) VALUES ('150c2fff-1029-47a5-aaa8-3e974e8442c6', 'sitex', 'Australia/NSW', '{}'::JSONB) RETURNING id; LOG: statement: commit; ---- LOG: statement: BEGIN LOG: execute <unnamed>: INSERT INTO site_owner (email, name, pwhash, data) VALUES ($1, $2, crypt($3, gen_salt('bf', 8)), $4::JSONB) RETURNING id DETAIL: parameters: $1 = 'test@email6', $2 = 'Name', $3 = 'password', $4 = '{}' LOG: execute <unnamed>: INSERT INTO site (owner, name, timezone, data) VALUES ($1, $2, $3, $4::JSONB) RETURNING id DETAIL: parameters: $1 = '3a83db7f-c82e-4b7a-a5c7-c0b43f415b0e', $2 = 'Test', $3 = 'Australia/NSW', $4 = '{}' ERROR: insert or update on table "site" violates foreign key constraint "site_owner_fkey" DETAIL: Key (owner)=(3a83db7f-c82e-4b7a-a5c7-c0b43f415b0e) is not present in table "site_owner". LOG: statement: ROLLBACK ==== The first 'successful' part is a result of SQL statements from psql, and the second 'unsuccessful' part is a result of client library function calls from my application. It seems to me they both have the same structure, except the first part is consist of 'statements' and the second part is consist of 'execute'(prepare statements, I guess). Any hints which can make the second part successful? Thanks - Jong-won
В списке pgsql-general по дате отправления: