Skip to content

Commit

Permalink
Removed random subquery alias generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruan Pearce-Authers committed Mar 29, 2018
1 parent ccd6541 commit 754a6c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/sql-generic.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ sql_select.DBIConnection <- function(con, select, from, where = NULL,
}

#' @export
sql_subquery.DBIConnection <- function(con, from, name = unique_name(), ...) {
sql_subquery.DBIConnection <- function(con, from, name = unique_name(), alias = name, ...) {
if (is.ident(from)) {
setNames(from, name)
} else {
build_sql("(", from, ") ", ident(name %||% random_table_name()), con = con)
build_sql("(", from, ") ", ident(alias), con = con)
}
}

Expand Down
2 changes: 1 addition & 1 deletion R/sql-render.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sql_render.op <- function(query, con = NULL, ...) {

#' @export
sql_render.select_query <- function(query, con = NULL, ..., root = FALSE) {
from <- sql_subquery(con, sql_render(query$from, con, ..., root = root), name = NULL)
from <- sql_subquery(con, sql_render(query$from, con, ..., root = root), name = NULL, alias = "a")

sql_select(
con, query$select, from, where = query$where, group_by = query$group_by,
Expand Down

0 comments on commit 754a6c7

Please sign in to comment.