From 3d48060515ba25b4c49d975a520ee0682327d1b7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 16 Feb 2024 06:45:52 +0100 Subject: Merging upstream version 21.1.1. Signed-off-by: Daniel Baumann --- sqlglot/dialects/redshift.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sqlglot/dialects/redshift.py') diff --git a/sqlglot/dialects/redshift.py b/sqlglot/dialects/redshift.py index a64c1d4..135ffc6 100644 --- a/sqlglot/dialects/redshift.py +++ b/sqlglot/dialects/redshift.py @@ -136,11 +136,11 @@ class Redshift(Postgres): refs.add( ( this.args["from"] if i == 0 else this.args["joins"][i - 1] - ).alias_or_name.lower() + ).this.alias.lower() ) - table = join.this - if isinstance(table, exp.Table): + table = join.this + if isinstance(table, exp.Table) and not join.args.get("on"): if table.parts[0].name.lower() in refs: table.replace(table.to_column()) return this @@ -158,6 +158,7 @@ class Redshift(Postgres): "UNLOAD": TokenType.COMMAND, "VARBYTE": TokenType.VARBINARY, } + KEYWORDS.pop("VALUES") # Redshift allows # to appear as a table identifier prefix SINGLE_TOKENS = Postgres.Tokenizer.SINGLE_TOKENS.copy() -- cgit v1.2.3