-
Notifications
You must be signed in to change notification settings - Fork 69
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
Set PG dialect While Running FKEY checks #518
base: BABEL_5_X_DEV__PG_17_X
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -430,11 +430,11 @@ RI_FKey_check(TriggerData *trigdata) | |
* referenced side. The reason is that our snapshot must be fresh in | ||
* order for the hack in find_inheritance_children() to work. | ||
*/ | ||
ri_PerformCheck(riinfo, &qkey, qplan, | ||
RUN_AS_PSQL(ri_PerformCheck(riinfo, &qkey, qplan, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to change RUN_AS_PSQL macro a bit. |
||
fk_rel, pk_rel, | ||
NULL, newslot, | ||
pk_rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE, | ||
SPI_OK_SELECT); | ||
SPI_OK_SELECT)); | ||
|
||
if (SPI_finish() != SPI_OK_FINISH) | ||
elog(ERROR, "SPI_finish failed"); | ||
|
@@ -557,11 +557,11 @@ ri_Check_Pk_Match(Relation pk_rel, Relation fk_rel, | |
/* | ||
* We have a plan now. Run it. | ||
*/ | ||
result = ri_PerformCheck(riinfo, &qkey, qplan, | ||
RUN_AS_PSQL(result = ri_PerformCheck(riinfo, &qkey, qplan, | ||
fk_rel, pk_rel, | ||
oldslot, NULL, | ||
true, /* treat like update */ | ||
SPI_OK_SELECT); | ||
SPI_OK_SELECT)); | ||
|
||
if (SPI_finish() != SPI_OK_FINISH) | ||
elog(ERROR, "SPI_finish failed"); | ||
|
@@ -749,11 +749,11 @@ ri_restrict(TriggerData *trigdata, bool is_no_action) | |
/* | ||
* We have a plan now. Run it to check for existing references. | ||
*/ | ||
ri_PerformCheck(riinfo, &qkey, qplan, | ||
RUN_AS_PSQL(ri_PerformCheck(riinfo, &qkey, qplan, | ||
fk_rel, pk_rel, | ||
oldslot, NULL, | ||
true, /* must detect new rows */ | ||
SPI_OK_SELECT); | ||
SPI_OK_SELECT)); | ||
|
||
if (SPI_finish() != SPI_OK_FINISH) | ||
elog(ERROR, "SPI_finish failed"); | ||
|
@@ -855,11 +855,11 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS) | |
* We have a plan now. Build up the arguments from the key values in the | ||
* deleted PK tuple and delete the referencing rows | ||
*/ | ||
ri_PerformCheck(riinfo, &qkey, qplan, | ||
RUN_AS_PSQL(ri_PerformCheck(riinfo, &qkey, qplan, | ||
fk_rel, pk_rel, | ||
oldslot, NULL, | ||
true, /* must detect new rows */ | ||
SPI_OK_DELETE); | ||
SPI_OK_DELETE)); | ||
|
||
if (SPI_finish() != SPI_OK_FINISH) | ||
elog(ERROR, "SPI_finish failed"); | ||
|
@@ -976,11 +976,11 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS) | |
/* | ||
* We have a plan now. Run it to update the existing references. | ||
*/ | ||
ri_PerformCheck(riinfo, &qkey, qplan, | ||
RUN_AS_PSQL(ri_PerformCheck(riinfo, &qkey, qplan, | ||
fk_rel, pk_rel, | ||
oldslot, newslot, | ||
true, /* must detect new rows */ | ||
SPI_OK_UPDATE); | ||
SPI_OK_UPDATE)); | ||
|
||
if (SPI_finish() != SPI_OK_FINISH) | ||
elog(ERROR, "SPI_finish failed"); | ||
|
@@ -1208,11 +1208,11 @@ ri_set(TriggerData *trigdata, bool is_set_null, int tgkind) | |
/* | ||
* We have a plan now. Run it to update the existing references. | ||
*/ | ||
ri_PerformCheck(riinfo, &qkey, qplan, | ||
RUN_AS_PSQL(ri_PerformCheck(riinfo, &qkey, qplan, | ||
fk_rel, pk_rel, | ||
oldslot, NULL, | ||
true, /* must detect new rows */ | ||
SPI_OK_UPDATE); | ||
SPI_OK_UPDATE)); | ||
|
||
if (SPI_finish() != SPI_OK_FINISH) | ||
elog(ERROR, "SPI_finish failed"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1783,8 +1783,7 @@ bool IsTsqlTableVariable(Relation relation) | |
{ | ||
return sql_dialect == SQL_DIALECT_TSQL | ||
&& relation | ||
&& relation->rd_rel->relpersistence == RELPERSISTENCE_TEMP | ||
&& relation->rd_rel->relname.data | ||
&& relation->rd_rel->relpersistence == RELPERSISTENCE_TEMP | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had to fix this due to following build error
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the original check was aimed at being NULL safe, so we should still add
Although I am not sure how relname would ever be NULL, but still good to have. |
||
&& strlen(relation->rd_rel->relname.data) >= 1 | ||
&& relation->rd_rel->relname.data[0] == '@'; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was getting build error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better to configure engine with
--without-readline
.