Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for foreign keys to hypertables #6989

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .unreleased/pr_6989
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implements: #6989 Add support for foreign keys from plain tables to hypertables
7 changes: 4 additions & 3 deletions coccinelle/namedata.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ struct I1
}

@rule_namedata_strlcpy@
expression E1, E2;
identifier I1;
expression E1;
symbol NAMEDATALEN;
@@
- strlcpy(E1, E2, NAMEDATALEN);
- strlcpy(I1, E1, NAMEDATALEN);
+ /* You are using strlcpy with NAMEDATALEN, please consider using NameData and namestrcpy instead. */
+ namestrcpy(E1, E2);
+ namestrcpy(I1, E1);

@rule_namedata_memcpy@
expression E1, E2;
Expand Down
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
Loading