Skip to content

Commit 3e1c312

Browse files
timm4205luis-garza-dev
authored andcommitted
fix: change the function language type from plpythonu to sql in integration test
1 parent bf3fba1 commit 3e1c312

5 files changed

Lines changed: 8 additions & 8 deletions

test/integration/metadata/test_metadataAPI_functions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ class FunctionColumnInfo:
123123
"DROP SCHEMA IF EXISTS {} cascade;".format(test_schema_2),
124124
"CREATE SCHEMA {}".format(test_schema_1),
125125
"CREATE SCHEMA {}".format(test_schema_2),
126-
"CREATE OR REPLACE FUNCTION {}.{}(test_column_smallint smallint, test_column_integer integer, test_column_bigint bigint, test_column_numeric numeric(10,5), test_column_real real, test_column_double double precision, test_column_boolean boolean, test_column_char char(20), test_column_varchar varchar(256), test_column_date date, test_column_timestamp timestamp) RETURNS int stable AS $$ return 1 $$ LANGUAGE plpythonu;".format(test_schema_1, test_func_1),
127-
"CREATE OR REPLACE FUNCTION {}.{}() RETURNS int stable AS $$ return 1 $$ LANGUAGE plpythonu;".format(test_schema_1, test_func_2),
128-
"CREATE OR REPLACE FUNCTION {}.{}() RETURNS int stable AS $$ return 1 $$ LANGUAGE plpythonu;".format(test_schema_2, test_func_3),
129-
"CREATE OR REPLACE FUNCTION {}.{}() RETURNS int stable AS $$ return 1 $$ LANGUAGE plpythonu;".format(test_schema_2, test_func_4)
126+
"CREATE OR REPLACE FUNCTION {}.{}(test_column_smallint smallint, test_column_integer integer, test_column_bigint bigint, test_column_numeric numeric(10,5), test_column_real real, test_column_double double precision, test_column_boolean boolean, test_column_char char(20), test_column_varchar varchar(256), test_column_date date, test_column_timestamp timestamp) RETURNS int stable AS $$ select 1 $$ LANGUAGE sql;".format(test_schema_1, test_func_1),
127+
"CREATE OR REPLACE FUNCTION {}.{}() RETURNS int stable AS $$ select 1 $$ LANGUAGE sql;".format(test_schema_1, test_func_2),
128+
"CREATE OR REPLACE FUNCTION {}.{}() RETURNS int stable AS $$ select 1 $$ LANGUAGE sql;".format(test_schema_2, test_func_3),
129+
"CREATE OR REPLACE FUNCTION {}.{}() RETURNS int stable AS $$ select 1 $$ LANGUAGE sql;".format(test_schema_2, test_func_4)
130130
)
131131

132132

test/integration/metadata/test_metadataAPI_special_character_handling_standard_delimited_identifier_case_insensitive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"GRANT SELECT ON \"{}\".\"{}\" TO \"{}\";".format(tem_object_sql_name, tem_object_sql_name+" child", user2_sql_name),
5252
"CREATE OR REPLACE PROCEDURE \"{}\".\"{}\"(\"{}\" OUT int) AS $$ BEGIN \"{}\" := 1; END; $$ LANGUAGE plpgsql;".format(tem_object_sql_name, tem_object_sql_name, tem_object_sql_name, tem_object_sql_name),
5353
# Hit error when create function with special character
54-
"CREATE OR REPLACE FUNCTION \"{}\".\"{}\"(\"{}\" int) RETURNS int stable AS $$ return 1 $$ LANGUAGE plpythonu;".format(tem_object_sql_name, tem_object_sql_name, function_col_name)
54+
"CREATE OR REPLACE FUNCTION \"{}\".\"{}\"(\"{}\" int) RETURNS int stable AS $$ select 1 $$ LANGUAGE sql;".format(tem_object_sql_name, tem_object_sql_name, function_col_name)
5555
)
5656

5757

test/integration/metadata/test_metadataAPI_special_character_handling_standard_delimited_identifier_case_sensitive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
# Hit error when create procedure with mixed case
5353
"CREATE OR REPLACE PROCEDURE \"{}\".\"{}\"(\"{}\" OUT int) AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql;".format(tem_object_sql_name, tem_object_sql_name, tem_object_sql_name, tem_object_sql_name),
5454
# Hit error when create function with special character
55-
"CREATE OR REPLACE FUNCTION \"{}\".\"{}\"(\"{}\" int) RETURNS int stable AS $$ return 1 $$ LANGUAGE plpythonu;".format(tem_object_sql_name, tem_object_sql_name, function_col_name)
55+
"CREATE OR REPLACE FUNCTION \"{}\".\"{}\"(\"{}\" int) RETURNS int stable AS $$ select 1 $$ LANGUAGE sql;".format(tem_object_sql_name, tem_object_sql_name, function_col_name)
5656
)
5757

5858
test_cases = [

test/integration/metadata/test_metadataAPI_special_character_handling_standard_identifier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"GRANT SELECT ON {}.{} TO {};".format(tem_object_name, tem_object_name+"_child", user2_name),
3939
"CREATE OR REPLACE PROCEDURE {}.{}({} OUT int) AS $$ BEGIN {} := 1; END; $$ LANGUAGE plpgsql;".format(tem_object_name, tem_object_name, tem_object_name, tem_object_name),
4040
# Hit error when create function with special character
41-
"CREATE OR REPLACE FUNCTION {}.{}({} int) RETURNS int stable AS $$ return 1 $$ LANGUAGE plpythonu;".format(tem_object_name, tem_object_name, function_col_name)
41+
"CREATE OR REPLACE FUNCTION {}.{}({} int) RETURNS int stable AS $$ select 1 $$ LANGUAGE sql;".format(tem_object_name, tem_object_name, function_col_name)
4242
)
4343

4444

test/integration/metadata/test_metadataAPI_sql_injection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"GRANT SELECT ON \"{}\".\"{}\" TO {};".format(schema_name, table_name, user),
4040
"GRANT SELECT (\"{}\") ON \"{}\".\"{}\" TO {};".format(col_name, schema_name, table_name, user2),
4141
"CREATE OR REPLACE PROCEDURE \"{}\".\"{}\"(\"{}\" OUT int) AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql;".format(schema_name, proc_name, proc_col_name),
42-
"CREATE OR REPLACE FUNCTION \"{}\".\"{}\"(\"{}\" int) RETURNS int stable AS $$ return 1 $$ LANGUAGE plpythonu;".format(schema_name, func_name, func_col_name),
42+
"CREATE OR REPLACE FUNCTION \"{}\".\"{}\"(\"{}\" int) RETURNS int stable AS $$ select 1 $$ LANGUAGE sql;".format(schema_name, func_name, func_col_name),
4343
)
4444

4545
test_cases = [

0 commit comments

Comments
 (0)