Skip to content

Commit

Permalink
Fix KeyError when inserting Child with relationship
Browse files Browse the repository at this point in the history
  • Loading branch information
toluaina committed Jan 7, 2021
1 parent 42c524f commit 94fecfb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pgsync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__author__ = 'Tolu Aina'
__email__ = '[email protected]'
__version__ = '1.1.23'
__version__ = '1.1.24'
2 changes: 1 addition & 1 deletion pgsync/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
WHERE indrelid = TG_RELID AND indisprimary
);
foreign_keys TEXT [] := (
SELECT ARRAY_AGG(constraint_column_usage.column_name)
SELECT ARRAY_AGG(constraint_column_usage.column_name) || ARRAY_AGG(key_column_usage.column_name)
FROM information_schema.table_constraints AS table_constraints
JOIN information_schema.key_column_usage AS key_column_usage
ON table_constraints.constraint_name = key_column_usage.constraint_name
Expand Down
10 changes: 1 addition & 9 deletions scripts/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ rm -rf .coverage.*
rm -rf *.egg-info
rm -rf .eggs
rm -rf .mypy_cache
find . -type f -name .book_* -exec rm -r "{}" \;
find . -type f -name .social_* -exec rm -r "{}" \;
find . -type f -name .airbnb_* -exec rm -r "{}" \;
find . -type f -name .airline_* -exec rm -r "{}" \;
find . -type f -name .movie_* -exec rm -r "{}" \;
find . -type f -name .quiz_* -exec rm -r "{}" \;
find . -type f -name .rental_* -exec rm -r "{}" \;
find . -type f -name .shakespeare_* -exec rm -r "{}" \;
find . -type f -name .survey_* -exec rm -r "{}" \;
find . -type f -name .*_* -exec rm -r "{}" \;
find . -type d -name *.egg-info -exec rm -r "{}" \;
find . -type d -name __pycache__ -exec rm -r "{}" \;
find . -type f -name *.pyc -exec rm -r "{}" \;
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.1.23
current_version = 1.1.24
commit = True
tag = True

Expand Down
3 changes: 1 addition & 2 deletions tests/test_trigger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Trigger tests."""
import pytest

from pgsync.trigger import CREATE_TRIGGER_TEMPLATE


Expand All @@ -24,7 +23,7 @@ def test_trigger_definition(self):
WHERE indrelid = TG_RELID AND indisprimary
);
foreign_keys TEXT [] := (
SELECT ARRAY_AGG(constraint_column_usage.column_name)
SELECT ARRAY_AGG(constraint_column_usage.column_name) || ARRAY_AGG(key_column_usage.column_name)
FROM information_schema.table_constraints AS table_constraints
JOIN information_schema.key_column_usage AS key_column_usage
ON table_constraints.constraint_name = key_column_usage.constraint_name
Expand Down

0 comments on commit 94fecfb

Please sign in to comment.