Comments (8)
Thank you for your infromation.
The cause of this issue is referential actions.
Referential actions other than the NO ACTION check cannot be deferred, even if the constraint is declared deferrable.
In the NO ACTION
case, I've confirmed to be deferred whithout DEFERRABLE
.
from testfixtures.
Maybe it's an issue with PostgreSQL 10? Until now, I only tried with PosgreSQL 9.x and it worked.
from testfixtures.
Also, you can try checking the permissions of this user. Does this user has permission to alter constraints?
from testfixtures.
I can execute ALTER CONSTRAINT
by non-superuser.
I'll try PostgreSQL 9.
USER=> ALTER TABLE "public"."environments" ALTER CONSTRAINT "environments_created_by_users_id_foreign" DEFERRABLE;
ALTER TABLE
USER=> BEGIN;
BEGIN
USER=> SET CONSTRAINTS ALL DEFERRED;
SET CONSTRAINTS
USER=> DELETE FROM "public"."users";
ERROR: update or delete on table "users" violates foreign key constraint "environments_created_by_users_id_foreign" on table "environments"
DETAIL: Key (id)=(1) is still referenced from table "environments".
USER=> COMMIT;
ROLLBACK
USER=> ALTER TABLE "public"."environments" ALTER CONSTRAINT "environments_created_by_users_id_foreign" NOT DEFERRABLE;
ALTER TABLE
from testfixtures.
I've tried PostgreSQL 9.6.6. The result is the same.
Does ALTER CONSTRAINT
approach require to create CONSTRAINT
with DEFERRABLE
?
It worked fine.
CONSTRAINT aaaaa FOREIGN KEY ("user")
REFERENCES public.users (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE
from testfixtures.
Does ALTER CONSTRAINT approach require to create CONSTRAINT with DEFERRABLE?
Yes, it does. We just found a missing information on README.
from testfixtures.
I see. Thank you.
from testfixtures.
Does ALTER CONSTRAINT approach require to create CONSTRAINT with DEFERRABLE?
Yes, it does. We just found a missing information on README.
Sorry, I was wrong. The package should temporarely make NON DEFERRABLE constraints DEFERRABLE to make it work. So this should not be the issue.
from testfixtures.
Related Issues (20)
- Add a new function to delete data after each test case HOT 1
- I want to create array type test data in postgres, but Iām struggling.
- I want to create array type test data in postgres, but Iām struggling HOT 2
- Dump output for a string is read as a date
- I am getting collumn not exist in loading fixtures HOT 1
- Force hex field as string type not binary type HOT 1
- CLI not working anymore on docker compose + M1 chip
- Error loading string data
- Can I use JSON files for fixtures? HOT 6
- Import failing github.com/ClickHouse/ch-go v0.55.0 - cannot find module providing package go.opentelemetry.io/otel/metric/global HOT 1
- Support TiDB
- Add support for "pgx" postgres driver/dialect. HOT 8
- Loading multiple yaml files with the same table name causes only the last one to be used. HOT 3
- Reset MySQL autoincrement? HOT 1
- Error "pq: unsupported jsonb version number 123" HOT 1
- can the entire table data be deleted and modified to delete the corresponding data HOT 1
- Error when using templates with incorrect order HOT 1
- Provide method to teardown fixture data HOT 4
- How do I seed multiple tables from a single file? HOT 1
- UseDropConstraint() not applied and tests failed because of relational constrains HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testfixtures.