From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | jamesstonehill(at)gmail(dot)com |
Subject: | BUG #15657: `session_replication_role = replica` not respected by truncation |
Date: | 2019-02-26 13:47:31 |
Message-ID: | 15657-f94bb6e3ad28e1e2@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15657
Logged by: James Stonehill
Email address: jamesstonehill(at)gmail(dot)com
PostgreSQL version: 11.1
Operating system: Mac OS 10.14.3
Description:
Truncation does not ignore foreign key triggers when the
session_replication_role is set to "replica" like DELETE does.
```
CREATE TABLE users (
id serial PRIMARY KEY
);
CREATE TABLE posts(
id serial PRIMARY KEY,
user_id INTEGER REFERENCES users(id)
);
INSERT INTO users(id) VALUES (1);
INSERT INTO posts(id, user_id) VALUES (1, 1);
SET session_replication_role = replica;
TRUNCATE users;
```
returns
> ERROR: cannot truncate a table referenced in a foreign key constraint
> DETAIL: Table "posts" references "users".
> HINT: Truncate table "posts" at the same time, or use TRUNCATE ...
CASCADE.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2019-02-26 14:11:12 | Re: BUG #15646: Inconsistent behavior for current_setting/set_config |
Previous Message | PG Bug reporting form | 2019-02-26 13:30:37 | BUG #15656: Not able to login database |