Skip to content

Commit

Permalink
Temporary change
Browse files Browse the repository at this point in the history
  • Loading branch information
AdRiley committed Sep 6, 2024
1 parent bd15441 commit 40f3c8b
Showing 1 changed file with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,22 +220,21 @@ type Connection
table_naming_helper.verify_table_name name <|
make_table_for_name self name alias
SQL_Query.Raw_SQL raw_sql -> handle_sql_errors <| alias.if_not_error <|
self.jdbc_connection.ensure_query_has_no_holes raw_sql . if_not_error <|
columns = self.fetch_columns raw_sql Statement_Setter.null
name = if alias == "" then (UUID.randomUUID.to_text) else alias
ctx = Context.for_query raw_sql name
## Any problems are treated as errors - e.g. if the query
contains clashing column names, it may very likely lead to
data corruption. Our renaming mechanism is used to fix issues
with existing tables with problematic names, but that
mechanism will only provide a false-sense of security in case
of a query, whereas a query like `SELECT 1 AS "A", 2 AS "A"`
will actually result in both columns `A` and `A 1` containing
the value 1; and value 2 being lost. That is why such queries
must fail.
r = DB_Table_Module.make_table self name columns ctx on_problems=Problem_Behavior.Report_Error
r.catch Any error->
Error.throw (Illegal_Argument.Error "The provided custom SQL query is invalid and may suffer data corruption when being processed, especially if it contains aliased column names, it may not be interpreted correctly. Please ensure the names are unique. The original error was: "+error.to_display_text cause=error)
columns = self.fetch_columns raw_sql Statement_Setter.null
name = if alias == "" then (UUID.randomUUID.to_text) else alias
ctx = Context.for_query raw_sql name
## Any problems are treated as errors - e.g. if the query
contains clashing column names, it may very likely lead to
data corruption. Our renaming mechanism is used to fix issues
with existing tables with problematic names, but that
mechanism will only provide a false-sense of security in case
of a query, whereas a query like `SELECT 1 AS "A", 2 AS "A"`
will actually result in both columns `A` and `A 1` containing
the value 1; and value 2 being lost. That is why such queries
must fail.
r = DB_Table_Module.make_table self name columns ctx on_problems=Problem_Behavior.Report_Error
r.catch Any error->
Error.throw (Illegal_Argument.Error "The provided custom SQL query is invalid and may suffer data corruption when being processed, especially if it contains aliased column names, it may not be interpreted correctly. Please ensure the names are unique. The original error was: "+error.to_display_text cause=error)

## PRIVATE
Execute the query and load the results into memory as a Table.
Expand Down

0 comments on commit 40f3c8b

Please sign in to comment.