Skip to content

Commit

Permalink
Add toasts to ENR for temp tables (#298)
Browse files Browse the repository at this point in the history
Fixes an issue with orphaned temp toast table entries.
Adding toasts to ENR for temp tables. This was originally introduced as part of #295 

Signed-off-by: Tim Chang <[email protected]>
  • Loading branch information
timchang514 authored Jan 25, 2024
1 parent 2e7abaf commit 5a69710
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/backend/catalog/pg_depend.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ deleteDependencyRecordsFor(Oid classId, Oid objectId,
((Form_pg_depend) GETSTRUCT(tup))->deptype == DEPENDENCY_EXTENSION)
continue;

CatalogTupleDelete(depRel, &tup->t_self);
if (!ENRdropTuple(depRel, tup))
CatalogTupleDelete(depRel, &tup->t_self);
count++;
}

Expand Down
2 changes: 2 additions & 0 deletions src/backend/catalog/toasting.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
*/
if (sql_dialect == SQL_DIALECT_TSQL && RelationIsBBFTableVariable(rel))
pg_toast_prefix = "@pg_toast";
else if (sql_dialect == SQL_DIALECT_TSQL && rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP && get_ENR_withoid(currentQueryEnv, rel->rd_id, ENR_TSQL_TEMP))
pg_toast_prefix = "#pg_toast";

snprintf(toast_relname, sizeof(toast_relname),
"%s_%u", pg_toast_prefix, relOid);
Expand Down

0 comments on commit 5a69710

Please sign in to comment.