Skip to content

Commit

Permalink
Add support for foreign keys to hypertables
Browse files Browse the repository at this point in the history
Currrently we only allow Hypertables references other tables, with
this patch the opposite direction is supported as well and tables
can have foreign key references into hypertables.
  • Loading branch information
svenklemm committed Jun 8, 2024
1 parent 45befd5 commit 1a41a63
Show file tree
Hide file tree
Showing 9 changed files with 743 additions and 44 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(SOURCES
extension.c
extension_constants.c
expression_utils.c
foreign_key.c
gapfill.c
guc.c
histogram.c
Expand Down
4 changes: 4 additions & 0 deletions src/chunk_constraint.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "dimension_vector.h"
#include "errors.h"
#include "export.h"
#include "foreign_key.h"
#include "hypercube.h"
#include "hypertable.h"
#include "partitioning.h"
Expand Down Expand Up @@ -512,6 +513,9 @@ ts_chunk_constraints_create(const Hypertable *ht, const Chunk *chunk)
Assert(list_length(cookedconstrs) == list_length(newconstrs));
CommandCounterIncrement();
}

/* Copy FK triggers to this chunk */
ts_chunk_copy_referencing_fk(ht, chunk);
}

ScanIterator
Expand Down
Loading

0 comments on commit 1a41a63

Please sign in to comment.