Adding upstream version 24.1.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
8b1190270c
commit
dd3422a695
70 changed files with 55134 additions and 50721 deletions
|
@ -22,6 +22,7 @@ class TestPostgres(Validator):
|
|||
self.assertIsInstance(expr, exp.AlterTable)
|
||||
self.assertEqual(expr.sql(dialect="postgres"), alter_table_only)
|
||||
|
||||
self.validate_identity("STRING_TO_ARRAY('xx~^~yy~^~zz', '~^~', 'yy')")
|
||||
self.validate_identity("SELECT x FROM t WHERE CAST($1 AS TEXT) = 'ok'")
|
||||
self.validate_identity("SELECT * FROM t TABLESAMPLE SYSTEM (50) REPEATABLE (55)")
|
||||
self.validate_identity("x @@ y")
|
||||
|
@ -327,6 +328,16 @@ class TestPostgres(Validator):
|
|||
"CAST(x AS BIGINT)",
|
||||
)
|
||||
|
||||
self.validate_all(
|
||||
"STRING_TO_ARRAY('xx~^~yy~^~zz', '~^~', 'yy')",
|
||||
read={
|
||||
"doris": "SPLIT_BY_STRING('xx~^~yy~^~zz', '~^~', 'yy')",
|
||||
},
|
||||
write={
|
||||
"doris": "SPLIT_BY_STRING('xx~^~yy~^~zz', '~^~', 'yy')",
|
||||
"postgres": "STRING_TO_ARRAY('xx~^~yy~^~zz', '~^~', 'yy')",
|
||||
},
|
||||
)
|
||||
self.validate_all(
|
||||
"SELECT ARRAY[1, 2, 3] @> ARRAY[1, 2]",
|
||||
read={
|
||||
|
@ -706,6 +717,9 @@ class TestPostgres(Validator):
|
|||
self.validate_identity(
|
||||
"COPY (SELECT * FROM t) TO 'file' WITH (FORMAT format, HEADER MATCH, FREEZE TRUE)"
|
||||
)
|
||||
self.validate_identity("cast(a as FLOAT)", "CAST(a AS DOUBLE PRECISION)")
|
||||
self.validate_identity("cast(a as FLOAT8)", "CAST(a AS DOUBLE PRECISION)")
|
||||
self.validate_identity("cast(a as FLOAT4)", "CAST(a AS REAL)")
|
||||
|
||||
def test_ddl(self):
|
||||
# Checks that user-defined types are parsed into DataType instead of Identifier
|
||||
|
@ -723,6 +737,8 @@ class TestPostgres(Validator):
|
|||
cdef.args["kind"].assert_is(exp.DataType)
|
||||
self.assertEqual(expr.sql(dialect="postgres"), "CREATE TABLE t (x INTERVAL DAY)")
|
||||
|
||||
self.validate_identity("CREATE TABLE t (col INT[3][5])")
|
||||
self.validate_identity("CREATE TABLE t (col INT[3])")
|
||||
self.validate_identity("CREATE INDEX IF NOT EXISTS ON t(c)")
|
||||
self.validate_identity("CREATE INDEX et_vid_idx ON et(vid) INCLUDE (fid)")
|
||||
self.validate_identity("CREATE INDEX idx_x ON x USING BTREE(x, y) WHERE (NOT y IS NULL)")
|
||||
|
@ -845,6 +861,14 @@ class TestPostgres(Validator):
|
|||
self.validate_identity(
|
||||
"CREATE UNLOGGED TABLE foo AS WITH t(c) AS (SELECT 1) SELECT * FROM (SELECT c AS c FROM t) AS temp"
|
||||
)
|
||||
self.validate_identity(
|
||||
"CREATE TABLE t (col integer ARRAY[3])",
|
||||
"CREATE TABLE t (col INT[3])",
|
||||
)
|
||||
self.validate_identity(
|
||||
"CREATE TABLE t (col integer ARRAY)",
|
||||
"CREATE TABLE t (col INT[])",
|
||||
)
|
||||
self.validate_identity(
|
||||
"CREATE FUNCTION x(INT) RETURNS INT SET search_path TO 'public'",
|
||||
"CREATE FUNCTION x(INT) RETURNS INT SET search_path = 'public'",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue