Skip to content

Commit

Permalink
Merge pull request rails#52004 from duffuniverse/fix-typo-in-active-r…
Browse files Browse the repository at this point in the history
…ecord-and-postgresql-guide

[ci skip] Fix a typo in Active Record and PostgreSQL guide
  • Loading branch information
carlosantoniodasilva authored Jun 3, 2024
2 parents 3f0b8ef + e1f00d2 commit 40a5236
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion guides/source/active_record_postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ Deferrable Foreign Keys

* [foreign key table constraints](https://www.postgresql.org/docs/current/sql-set-constraints.html)

By default, table constraints in PostgreSQL are checked immediately after each statement. It intentionally does not allow creating records where the referenced record is not yet in the referenced table. It is possible to run this integrity check later on when the transactions is committed by adding `DEFERRABLE` to the foreign key definition though. To defer all checks by default it can be set to `DEFERRABLE INITIALLY DEFERRED`. Rails exposes this PostgreSQL feature by adding the `:deferrable` key to the `foreign_key` options in the `add_reference` and `add_foreign_key` methods.
By default, table constraints in PostgreSQL are checked immediately after each statement. It intentionally does not allow creating records where the referenced record is not yet in the referenced table. It is possible to run this integrity check later on when the transaction is committed by adding `DEFERRABLE` to the foreign key definition though. To defer all checks by default it can be set to `DEFERRABLE INITIALLY DEFERRED`. Rails exposes this PostgreSQL feature by adding the `:deferrable` key to the `foreign_key` options in the `add_reference` and `add_foreign_key` methods.

One example of this is creating circular dependencies in a transaction even if you have created foreign keys:

Expand Down

0 comments on commit 40a5236

Please sign in to comment.