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

Fix retrieval of temporary table's column information #1308

Merged
merged 7 commits into from
Mar 10, 2025

Conversation

aidanharan
Copy link
Contributor

@aidanharan aidanharan commented Mar 6, 2025

This PR fixes an issue with inserting into temporary tables (#1307).

Temporary tables names start with the # character. The issue was happening because we were retrieving the temporary table's column information from the normal database rather than the TEMPDB database.

SQL Server does not store the temporary table name as it is given. For example, the #temp_users table might be stored in the TEMPDB..objects table's name column as #temp_users_________________________________________________________________________________________________________00000000000B. To get around this the column_definitions_sql query has been updated to use the Object_ID column instead.

Ref:

@aidanharan aidanharan changed the title Fix retrieval of temporary table column information Fix retrieval of temporary table's column information Mar 7, 2025
@aidanharan aidanharan added the bug label Mar 7, 2025
@aidanharan aidanharan marked this pull request as ready for review March 7, 2025 14:42
@aidanharan aidanharan merged commit 6f9c242 into main Mar 10, 2025
6 checks passed
@aidanharan aidanharan deleted the temporary-tables branch March 10, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant