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

"UseTempDb" setting for PostgreSQL is not working properly #1675

Open
fabionaspolini opened this issue Feb 6, 2025 · 0 comments
Open

"UseTempDb" setting for PostgreSQL is not working properly #1675

fabionaspolini opened this issue Feb 6, 2025 · 0 comments

Comments

@fabionaspolini
Copy link

Both add the "temp" keyword on "create table" statement only when the "unlogged" argument is true, but the correct thing would be to add it when the "useTempDb" argument is true.

public static string CreateOutputStatsTable(string newTableName, bool useTempDb, bool unlogged)
{
string keywordPrefix = "";
if (unlogged == true)
{
keywordPrefix = "TEMP "; // "TEMP " or "TEMPORARY "
}
else if(unlogged) // can not be combined with TEMP since Temporary tables are not logged by default.
{
keywordPrefix = "UNLOGGED ";
}
var q = @$"CREATE {keywordPrefix}TABLE IF NOT EXISTS {newTableName} (""xmaxNumber"" xid)"; // col name can't be just 'xmax' - conflicts with system column
q = q.Replace("[", @"""").Replace("]", @"""");
return q;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant