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

resolve temp table name to original #57

Merged
merged 1 commit into from
Oct 30, 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
2 changes: 2 additions & 0 deletions include/pg.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extern "C" {
#include "storage/smgr.h"
#include "utils/catcache.h"
#include "utils/syscache.h"
#include "utils/lsyscache.h"

#include "catalog/dependency.h"
#include "catalog/pg_extension.h"
Expand Down Expand Up @@ -99,6 +100,7 @@ extern "C" {
#include "catalog/pg_namespace.h"
#include "utils/catcache.h"
#include "utils/syscache.h"
#include "utils/lsyscache.h"

#include "catalog/heap.h"

Expand Down
2 changes: 2 additions & 0 deletions include/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ std::string make_yezzey_url(const std::string &prefix, int64_t modcounts,

std::vector<int64_t> parseModcounts(const std::string &prefix,
std::string name);

std::string resolve_temp_relname(char *tempname);
#endif

EXTERNC void getYezzeyExternalStoragePathByCoords(
Expand Down
2 changes: 1 addition & 1 deletion src/proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ EXTERNC SMGRFile yezzey_AORelOpenSegFile(Oid reloid, char *nspname,
*/
Assert(RecoveryInProgress());
} else {
yfd.relname = std::string(relname);
yfd.relname = resolve_temp_relname(relname);
yfd.nspname = std::string(nspname);
}
} else {
Expand Down
10 changes: 10 additions & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,13 @@ XLogRecPtr yezzeyGetXStorageInsertLsn(void) {

return GetXLogWriteRecPtr();
}

std::string resolve_temp_relname(char* tempname) {
std::string name(tempname);
if (strncmp(name.c_str(), "pg_temp_", 8) == 0)
{
int oid = atoi(name.substr(8, name.find('_', 8)).c_str());
return std::string(get_rel_name(oid));
}
return tempname;
}
Loading