We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Type error when converting datediff from redshift to trino 
```
sql = "select datediff(week,'2009-01-01','2009-12-31')"
converted_sql = sqlglot.transpile(sql, read="redshift", write="trino")[0]
print(converted_sql)
SELECT DATE_DIFF('week', '2009-01-01', '2009-12-31')
```

Trino error: `Unexpected parameters (varchar(4), varchar(10), varchar(10)) for function date_diff. Expected: date_diff(varchar(x), date, date), date_diff(varchar(x), timestamp(p), timestamp(p)), date_diff(varchar(x), timestamp(p) with time zone, timestamp(p) with time zone), date_diff(varchar(x), time(p), time(p)), date_diff(varchar(x), time(p) with time zone, time(p) with time zone)'
`

Changing the SQL to `SELECT DATE_DIFF('week', DATE'2009-01-01', DATE'2009-12-31')` works in Trino

https://trino.io/docs/current/functions/datetime.html

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sqlglot/dialects/redshift.py`
Content:
```
1 from __future__ import annotations
2 
3 import typing as t
4 
5 from sqlglot import exp, transforms
6 from sqlglot.dialects.dialect import rename_func
7 from sqlglot.dialects.postgres import Postgres
8 from sqlglot.helper import seq_get
9 from sqlglot.tokens import TokenType
10 
11 
12 def _json_sql(self: Postgres.Generator, expression: exp.JSONExtract | exp.JSONExtractScalar) -> str:
13     return f'{self.sql(expression, "this")}."{expression.expression.name}"'
14 
15 
16 class Redshift(Postgres):
17     time_format = "'YYYY-MM-DD HH:MI:SS'"
18     time_mapping = {
19         **Postgres.time_mapping,
20         "MON": "%b",
21         "HH": "%H",
22     }
23 
24     class Parser(Postgres.Parser):
25         FUNCTIONS = {
26             **Postgres.Parser.FUNCTIONS,
27             "DATEADD": lambda args: exp.DateAdd(
28                 this=seq_get(args, 2),
29                 expression=seq_get(args, 1),
30                 unit=seq_get(args, 0),
31             ),
32             "DATEDIFF": lambda args: exp.DateDiff(
33                 this=seq_get(args, 2),
34                 expression=seq_get(args, 1),
35                 unit=seq_get(args, 0),
36             ),
37             "NVL": exp.Coalesce.from_arg_list,
38             "STRTOL": exp.FromBase.from_arg_list,
39         }
40 
41         CONVERT_TYPE_FIRST = True
42 
43         def _parse_types(
44             self, check_func: bool = False, schema: bool = False
45         ) -> t.Optional[exp.Expression]:
46             this = super()._parse_types(check_func=check_func, schema=schema)
47 
48             if (
49                 isinstance(this, exp.DataType)
50                 and this.is_type("varchar")
51                 and this.expressions
52                 and this.expressions[0].this == exp.column("MAX")
53             ):
54                 this.set("expressions", [exp.Var(this="MAX")])
55 
56             return this
57 
58     class Tokenizer(Postgres.Tokenizer):
59         BIT_STRINGS = []
60         HEX_STRINGS = []
61         STRING_ESCAPES = ["\\"]
62 
63         KEYWORDS = {
64             **Postgres.Tokenizer.KEYWORDS,
65             "HLLSKETCH": TokenType.HLLSKETCH,
66             "SUPER": TokenType.SUPER,
67             "SYSDATE": TokenType.CURRENT_TIMESTAMP,
68             "TIME": TokenType.TIMESTAMP,
69             "TIMETZ": TokenType.TIMESTAMPTZ,
70             "TOP": TokenType.TOP,
71             "UNLOAD": TokenType.COMMAND,
72             "VARBYTE": TokenType.VARBINARY,
73         }
74 
75         # Redshift allows # to appear as a table identifier prefix
76         SINGLE_TOKENS = Postgres.Tokenizer.SINGLE_TOKENS.copy()
77         SINGLE_TOKENS.pop("#")
78 
79     class Generator(Postgres.Generator):
80         LOCKING_READS_SUPPORTED = False
81         RENAME_TABLE_WITH_DB = False
82 
83         TYPE_MAPPING = {
84             **Postgres.Generator.TYPE_MAPPING,
85             exp.DataType.Type.BINARY: "VARBYTE",
86             exp.DataType.Type.VARBINARY: "VARBYTE",
87             exp.DataType.Type.INT: "INTEGER",
88         }
89 
90         PROPERTIES_LOCATION = {
91             **Postgres.Generator.PROPERTIES_LOCATION,
92             exp.LikeProperty: exp.Properties.Location.POST_WITH,
93         }
94 
95         TRANSFORMS = {
96             **Postgres.Generator.TRANSFORMS,
97             exp.CurrentTimestamp: lambda self, e: "SYSDATE",
98             exp.DateAdd: lambda self, e: self.func(
99                 "DATEADD", exp.var(e.text("unit") or "day"), e.expression, e.this
100             ),
101             exp.DateDiff: lambda self, e: self.func(
102                 "DATEDIFF", exp.var(e.text("unit") or "day"), e.expression, e.this
103             ),
104             exp.DistKeyProperty: lambda self, e: f"DISTKEY({e.name})",
105             exp.DistStyleProperty: lambda self, e: self.naked_property(e),
106             exp.JSONExtract: _json_sql,
107             exp.JSONExtractScalar: _json_sql,
108             exp.Select: transforms.preprocess([transforms.eliminate_distinct_on]),
109             exp.SortKeyProperty: lambda self, e: f"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})",
110             exp.FromBase: rename_func("STRTOL"),
111         }
112 
113         # Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots
114         TRANSFORMS.pop(exp.Pivot)
115 
116         # Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)
117         TRANSFORMS.pop(exp.Pow)
118 
119         RESERVED_KEYWORDS = {*Postgres.Generator.RESERVED_KEYWORDS, "snapshot", "type"}
120 
121         def values_sql(self, expression: exp.Values) -> str:
122             """
123             Converts `VALUES...` expression into a series of unions.
124 
125             Note: If you have a lot of unions then this will result in a large number of recursive statements to
126             evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be
127             very slow.
128             """
129 
130             # The VALUES clause is still valid in an `INSERT INTO ..` statement, for example
131             if not expression.find_ancestor(exp.From, exp.Join):
132                 return super().values_sql(expression)
133 
134             column_names = expression.alias and expression.args["alias"].columns
135 
136             selects = []
137             rows = [tuple_exp.expressions for tuple_exp in expression.expressions]
138 
139             for i, row in enumerate(rows):
140                 if i == 0 and column_names:
141                     row = [
142                         exp.alias_(value, column_name)
143                         for value, column_name in zip(row, column_names)
144                     ]
145 
146                 selects.append(exp.Select(expressions=row))
147 
148             subquery_expression: exp.Select | exp.Union = selects[0]
149             if len(selects) > 1:
150                 for select in selects[1:]:
151                     subquery_expression = exp.union(subquery_expression, select, distinct=False)
152 
153             return self.subquery_sql(subquery_expression.subquery(expression.alias))
154 
155         def with_properties(self, properties: exp.Properties) -> str:
156             """Redshift doesn't have `WITH` as part of their with_properties so we remove it"""
157             return self.properties(properties, prefix=" ", suffix="")
158 
159         def datatype_sql(self, expression: exp.DataType) -> str:
160             """
161             Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean
162             VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type
163             without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert
164             `TEXT` to `VARCHAR`.
165             """
166             if expression.is_type("text"):
167                 expression = expression.copy()
168                 expression.set("this", exp.DataType.Type.VARCHAR)
169                 precision = expression.args.get("expressions")
170 
171                 if not precision:
172                     expression.append("expressions", exp.Var(this="MAX"))
173 
174             return super().datatype_sql(expression)
175
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/sqlglot/dialects/redshift.py b/sqlglot/dialects/redshift.py
--- a/sqlglot/dialects/redshift.py
+++ b/sqlglot/dialects/redshift.py
@@ -25,13 +25,13 @@
         FUNCTIONS = {
             **Postgres.Parser.FUNCTIONS,
             "DATEADD": lambda args: exp.DateAdd(
-                this=seq_get(args, 2),
+                this=exp.TsOrDsToDate(this=seq_get(args, 2)),
                 expression=seq_get(args, 1),
                 unit=seq_get(args, 0),
             ),
             "DATEDIFF": lambda args: exp.DateDiff(
-                this=seq_get(args, 2),
-                expression=seq_get(args, 1),
+                this=exp.TsOrDsToDate(this=seq_get(args, 2)),
+                expression=exp.TsOrDsToDate(this=seq_get(args, 1)),
                 unit=seq_get(args, 0),
             ),
             "NVL": exp.Coalesce.from_arg_list,
@@ -103,11 +103,12 @@
             ),
             exp.DistKeyProperty: lambda self, e: f"DISTKEY({e.name})",
             exp.DistStyleProperty: lambda self, e: self.naked_property(e),
+            exp.FromBase: rename_func("STRTOL"),
             exp.JSONExtract: _json_sql,
             exp.JSONExtractScalar: _json_sql,
             exp.Select: transforms.preprocess([transforms.eliminate_distinct_on]),
             exp.SortKeyProperty: lambda self, e: f"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})",
-            exp.FromBase: rename_func("STRTOL"),
+            exp.TsOrDsToDate: lambda self, e: self.sql(e.this),
         }
 
         # Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots

{"golden_diff": "diff --git a/sqlglot/dialects/redshift.py b/sqlglot/dialects/redshift.py\n--- a/sqlglot/dialects/redshift.py\n+++ b/sqlglot/dialects/redshift.py\n@@ -25,13 +25,13 @@\n         FUNCTIONS = {\n             **Postgres.Parser.FUNCTIONS,\n             \"DATEADD\": lambda args: exp.DateAdd(\n-                this=seq_get(args, 2),\n+                this=exp.TsOrDsToDate(this=seq_get(args, 2)),\n                 expression=seq_get(args, 1),\n                 unit=seq_get(args, 0),\n             ),\n             \"DATEDIFF\": lambda args: exp.DateDiff(\n-                this=seq_get(args, 2),\n-                expression=seq_get(args, 1),\n+                this=exp.TsOrDsToDate(this=seq_get(args, 2)),\n+                expression=exp.TsOrDsToDate(this=seq_get(args, 1)),\n                 unit=seq_get(args, 0),\n             ),\n             \"NVL\": exp.Coalesce.from_arg_list,\n@@ -103,11 +103,12 @@\n             ),\n             exp.DistKeyProperty: lambda self, e: f\"DISTKEY({e.name})\",\n             exp.DistStyleProperty: lambda self, e: self.naked_property(e),\n+            exp.FromBase: rename_func(\"STRTOL\"),\n             exp.JSONExtract: _json_sql,\n             exp.JSONExtractScalar: _json_sql,\n             exp.Select: transforms.preprocess([transforms.eliminate_distinct_on]),\n             exp.SortKeyProperty: lambda self, e: f\"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})\",\n-            exp.FromBase: rename_func(\"STRTOL\"),\n+            exp.TsOrDsToDate: lambda self, e: self.sql(e.this),\n         }\n \n         # Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots\n", "issue": "Type error when converting datediff from redshift to trino \n```\r\nsql = \"select datediff(week,'2009-01-01','2009-12-31')\"\r\nconverted_sql = sqlglot.transpile(sql, read=\"redshift\", write=\"trino\")[0]\r\nprint(converted_sql)\r\nSELECT DATE_DIFF('week', '2009-01-01', '2009-12-31')\r\n```\r\n\r\nTrino error: `Unexpected parameters (varchar(4), varchar(10), varchar(10)) for function date_diff. Expected: date_diff(varchar(x), date, date), date_diff(varchar(x), timestamp(p), timestamp(p)), date_diff(varchar(x), timestamp(p) with time zone, timestamp(p) with time zone), date_diff(varchar(x), time(p), time(p)), date_diff(varchar(x), time(p) with time zone, time(p) with time zone)'\r\n`\r\n\r\nChanging the SQL to `SELECT DATE_DIFF('week', DATE'2009-01-01', DATE'2009-12-31')` works in Trino\r\n\r\nhttps://trino.io/docs/current/functions/datetime.html\n", "before_files": [{"content": "from __future__ import annotations\n\nimport typing as t\n\nfrom sqlglot import exp, transforms\nfrom sqlglot.dialects.dialect import rename_func\nfrom sqlglot.dialects.postgres import Postgres\nfrom sqlglot.helper import seq_get\nfrom sqlglot.tokens import TokenType\n\n\ndef _json_sql(self: Postgres.Generator, expression: exp.JSONExtract | exp.JSONExtractScalar) -> str:\n    return f'{self.sql(expression, \"this\")}.\"{expression.expression.name}\"'\n\n\nclass Redshift(Postgres):\n    time_format = \"'YYYY-MM-DD HH:MI:SS'\"\n    time_mapping = {\n        **Postgres.time_mapping,\n        \"MON\": \"%b\",\n        \"HH\": \"%H\",\n    }\n\n    class Parser(Postgres.Parser):\n        FUNCTIONS = {\n            **Postgres.Parser.FUNCTIONS,\n            \"DATEADD\": lambda args: exp.DateAdd(\n                this=seq_get(args, 2),\n                expression=seq_get(args, 1),\n                unit=seq_get(args, 0),\n            ),\n            \"DATEDIFF\": lambda args: exp.DateDiff(\n                this=seq_get(args, 2),\n                expression=seq_get(args, 1),\n                unit=seq_get(args, 0),\n            ),\n            \"NVL\": exp.Coalesce.from_arg_list,\n            \"STRTOL\": exp.FromBase.from_arg_list,\n        }\n\n        CONVERT_TYPE_FIRST = True\n\n        def _parse_types(\n            self, check_func: bool = False, schema: bool = False\n        ) -> t.Optional[exp.Expression]:\n            this = super()._parse_types(check_func=check_func, schema=schema)\n\n            if (\n                isinstance(this, exp.DataType)\n                and this.is_type(\"varchar\")\n                and this.expressions\n                and this.expressions[0].this == exp.column(\"MAX\")\n            ):\n                this.set(\"expressions\", [exp.Var(this=\"MAX\")])\n\n            return this\n\n    class Tokenizer(Postgres.Tokenizer):\n        BIT_STRINGS = []\n        HEX_STRINGS = []\n        STRING_ESCAPES = [\"\\\\\"]\n\n        KEYWORDS = {\n            **Postgres.Tokenizer.KEYWORDS,\n            \"HLLSKETCH\": TokenType.HLLSKETCH,\n            \"SUPER\": TokenType.SUPER,\n            \"SYSDATE\": TokenType.CURRENT_TIMESTAMP,\n            \"TIME\": TokenType.TIMESTAMP,\n            \"TIMETZ\": TokenType.TIMESTAMPTZ,\n            \"TOP\": TokenType.TOP,\n            \"UNLOAD\": TokenType.COMMAND,\n            \"VARBYTE\": TokenType.VARBINARY,\n        }\n\n        # Redshift allows # to appear as a table identifier prefix\n        SINGLE_TOKENS = Postgres.Tokenizer.SINGLE_TOKENS.copy()\n        SINGLE_TOKENS.pop(\"#\")\n\n    class Generator(Postgres.Generator):\n        LOCKING_READS_SUPPORTED = False\n        RENAME_TABLE_WITH_DB = False\n\n        TYPE_MAPPING = {\n            **Postgres.Generator.TYPE_MAPPING,\n            exp.DataType.Type.BINARY: \"VARBYTE\",\n            exp.DataType.Type.VARBINARY: \"VARBYTE\",\n            exp.DataType.Type.INT: \"INTEGER\",\n        }\n\n        PROPERTIES_LOCATION = {\n            **Postgres.Generator.PROPERTIES_LOCATION,\n            exp.LikeProperty: exp.Properties.Location.POST_WITH,\n        }\n\n        TRANSFORMS = {\n            **Postgres.Generator.TRANSFORMS,\n            exp.CurrentTimestamp: lambda self, e: \"SYSDATE\",\n            exp.DateAdd: lambda self, e: self.func(\n                \"DATEADD\", exp.var(e.text(\"unit\") or \"day\"), e.expression, e.this\n            ),\n            exp.DateDiff: lambda self, e: self.func(\n                \"DATEDIFF\", exp.var(e.text(\"unit\") or \"day\"), e.expression, e.this\n            ),\n            exp.DistKeyProperty: lambda self, e: f\"DISTKEY({e.name})\",\n            exp.DistStyleProperty: lambda self, e: self.naked_property(e),\n            exp.JSONExtract: _json_sql,\n            exp.JSONExtractScalar: _json_sql,\n            exp.Select: transforms.preprocess([transforms.eliminate_distinct_on]),\n            exp.SortKeyProperty: lambda self, e: f\"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})\",\n            exp.FromBase: rename_func(\"STRTOL\"),\n        }\n\n        # Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots\n        TRANSFORMS.pop(exp.Pivot)\n\n        # Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)\n        TRANSFORMS.pop(exp.Pow)\n\n        RESERVED_KEYWORDS = {*Postgres.Generator.RESERVED_KEYWORDS, \"snapshot\", \"type\"}\n\n        def values_sql(self, expression: exp.Values) -> str:\n            \"\"\"\n            Converts `VALUES...` expression into a series of unions.\n\n            Note: If you have a lot of unions then this will result in a large number of recursive statements to\n            evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be\n            very slow.\n            \"\"\"\n\n            # The VALUES clause is still valid in an `INSERT INTO ..` statement, for example\n            if not expression.find_ancestor(exp.From, exp.Join):\n                return super().values_sql(expression)\n\n            column_names = expression.alias and expression.args[\"alias\"].columns\n\n            selects = []\n            rows = [tuple_exp.expressions for tuple_exp in expression.expressions]\n\n            for i, row in enumerate(rows):\n                if i == 0 and column_names:\n                    row = [\n                        exp.alias_(value, column_name)\n                        for value, column_name in zip(row, column_names)\n                    ]\n\n                selects.append(exp.Select(expressions=row))\n\n            subquery_expression: exp.Select | exp.Union = selects[0]\n            if len(selects) > 1:\n                for select in selects[1:]:\n                    subquery_expression = exp.union(subquery_expression, select, distinct=False)\n\n            return self.subquery_sql(subquery_expression.subquery(expression.alias))\n\n        def with_properties(self, properties: exp.Properties) -> str:\n            \"\"\"Redshift doesn't have `WITH` as part of their with_properties so we remove it\"\"\"\n            return self.properties(properties, prefix=\" \", suffix=\"\")\n\n        def datatype_sql(self, expression: exp.DataType) -> str:\n            \"\"\"\n            Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean\n            VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type\n            without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert\n            `TEXT` to `VARCHAR`.\n            \"\"\"\n            if expression.is_type(\"text\"):\n                expression = expression.copy()\n                expression.set(\"this\", exp.DataType.Type.VARCHAR)\n                precision = expression.args.get(\"expressions\")\n\n                if not precision:\n                    expression.append(\"expressions\", exp.Var(this=\"MAX\"))\n\n            return super().datatype_sql(expression)\n", "path": "sqlglot/dialects/redshift.py"}], "after_files": [{"content": "from __future__ import annotations\n\nimport typing as t\n\nfrom sqlglot import exp, transforms\nfrom sqlglot.dialects.dialect import rename_func\nfrom sqlglot.dialects.postgres import Postgres\nfrom sqlglot.helper import seq_get\nfrom sqlglot.tokens import TokenType\n\n\ndef _json_sql(self: Postgres.Generator, expression: exp.JSONExtract | exp.JSONExtractScalar) -> str:\n    return f'{self.sql(expression, \"this\")}.\"{expression.expression.name}\"'\n\n\nclass Redshift(Postgres):\n    time_format = \"'YYYY-MM-DD HH:MI:SS'\"\n    time_mapping = {\n        **Postgres.time_mapping,\n        \"MON\": \"%b\",\n        \"HH\": \"%H\",\n    }\n\n    class Parser(Postgres.Parser):\n        FUNCTIONS = {\n            **Postgres.Parser.FUNCTIONS,\n            \"DATEADD\": lambda args: exp.DateAdd(\n                this=exp.TsOrDsToDate(this=seq_get(args, 2)),\n                expression=seq_get(args, 1),\n                unit=seq_get(args, 0),\n            ),\n            \"DATEDIFF\": lambda args: exp.DateDiff(\n                this=exp.TsOrDsToDate(this=seq_get(args, 2)),\n                expression=exp.TsOrDsToDate(this=seq_get(args, 1)),\n                unit=seq_get(args, 0),\n            ),\n            \"NVL\": exp.Coalesce.from_arg_list,\n            \"STRTOL\": exp.FromBase.from_arg_list,\n        }\n\n        CONVERT_TYPE_FIRST = True\n\n        def _parse_types(\n            self, check_func: bool = False, schema: bool = False\n        ) -> t.Optional[exp.Expression]:\n            this = super()._parse_types(check_func=check_func, schema=schema)\n\n            if (\n                isinstance(this, exp.DataType)\n                and this.is_type(\"varchar\")\n                and this.expressions\n                and this.expressions[0].this == exp.column(\"MAX\")\n            ):\n                this.set(\"expressions\", [exp.Var(this=\"MAX\")])\n\n            return this\n\n    class Tokenizer(Postgres.Tokenizer):\n        BIT_STRINGS = []\n        HEX_STRINGS = []\n        STRING_ESCAPES = [\"\\\\\"]\n\n        KEYWORDS = {\n            **Postgres.Tokenizer.KEYWORDS,\n            \"HLLSKETCH\": TokenType.HLLSKETCH,\n            \"SUPER\": TokenType.SUPER,\n            \"SYSDATE\": TokenType.CURRENT_TIMESTAMP,\n            \"TIME\": TokenType.TIMESTAMP,\n            \"TIMETZ\": TokenType.TIMESTAMPTZ,\n            \"TOP\": TokenType.TOP,\n            \"UNLOAD\": TokenType.COMMAND,\n            \"VARBYTE\": TokenType.VARBINARY,\n        }\n\n        # Redshift allows # to appear as a table identifier prefix\n        SINGLE_TOKENS = Postgres.Tokenizer.SINGLE_TOKENS.copy()\n        SINGLE_TOKENS.pop(\"#\")\n\n    class Generator(Postgres.Generator):\n        LOCKING_READS_SUPPORTED = False\n        RENAME_TABLE_WITH_DB = False\n\n        TYPE_MAPPING = {\n            **Postgres.Generator.TYPE_MAPPING,\n            exp.DataType.Type.BINARY: \"VARBYTE\",\n            exp.DataType.Type.VARBINARY: \"VARBYTE\",\n            exp.DataType.Type.INT: \"INTEGER\",\n        }\n\n        PROPERTIES_LOCATION = {\n            **Postgres.Generator.PROPERTIES_LOCATION,\n            exp.LikeProperty: exp.Properties.Location.POST_WITH,\n        }\n\n        TRANSFORMS = {\n            **Postgres.Generator.TRANSFORMS,\n            exp.CurrentTimestamp: lambda self, e: \"SYSDATE\",\n            exp.DateAdd: lambda self, e: self.func(\n                \"DATEADD\", exp.var(e.text(\"unit\") or \"day\"), e.expression, e.this\n            ),\n            exp.DateDiff: lambda self, e: self.func(\n                \"DATEDIFF\", exp.var(e.text(\"unit\") or \"day\"), e.expression, e.this\n            ),\n            exp.DistKeyProperty: lambda self, e: f\"DISTKEY({e.name})\",\n            exp.DistStyleProperty: lambda self, e: self.naked_property(e),\n            exp.FromBase: rename_func(\"STRTOL\"),\n            exp.JSONExtract: _json_sql,\n            exp.JSONExtractScalar: _json_sql,\n            exp.Select: transforms.preprocess([transforms.eliminate_distinct_on]),\n            exp.SortKeyProperty: lambda self, e: f\"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})\",\n            exp.TsOrDsToDate: lambda self, e: self.sql(e.this),\n        }\n\n        # Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots\n        TRANSFORMS.pop(exp.Pivot)\n\n        # Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)\n        TRANSFORMS.pop(exp.Pow)\n\n        RESERVED_KEYWORDS = {*Postgres.Generator.RESERVED_KEYWORDS, \"snapshot\", \"type\"}\n\n        def values_sql(self, expression: exp.Values) -> str:\n            \"\"\"\n            Converts `VALUES...` expression into a series of unions.\n\n            Note: If you have a lot of unions then this will result in a large number of recursive statements to\n            evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be\n            very slow.\n            \"\"\"\n\n            # The VALUES clause is still valid in an `INSERT INTO ..` statement, for example\n            if not expression.find_ancestor(exp.From, exp.Join):\n                return super().values_sql(expression)\n\n            column_names = expression.alias and expression.args[\"alias\"].columns\n\n            selects = []\n            rows = [tuple_exp.expressions for tuple_exp in expression.expressions]\n\n            for i, row in enumerate(rows):\n                if i == 0 and column_names:\n                    row = [\n                        exp.alias_(value, column_name)\n                        for value, column_name in zip(row, column_names)\n                    ]\n\n                selects.append(exp.Select(expressions=row))\n\n            subquery_expression: exp.Select | exp.Union = selects[0]\n            if len(selects) > 1:\n                for select in selects[1:]:\n                    subquery_expression = exp.union(subquery_expression, select, distinct=False)\n\n            return self.subquery_sql(subquery_expression.subquery(expression.alias))\n\n        def with_properties(self, properties: exp.Properties) -> str:\n            \"\"\"Redshift doesn't have `WITH` as part of their with_properties so we remove it\"\"\"\n            return self.properties(properties, prefix=\" \", suffix=\"\")\n\n        def datatype_sql(self, expression: exp.DataType) -> str:\n            \"\"\"\n            Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean\n            VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type\n            without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert\n            `TEXT` to `VARCHAR`.\n            \"\"\"\n            if expression.is_type(\"text\"):\n                expression = expression.copy()\n                expression.set(\"this\", exp.DataType.Type.VARCHAR)\n                precision = expression.args.get(\"expressions\")\n\n                if not precision:\n                    expression.append(\"expressions\", exp.Var(this=\"MAX\"))\n\n            return super().datatype_sql(expression)\n", "path": "sqlglot/dialects/redshift.py"}]}