aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/pg
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-11-20 17:37:57 +0000
committerGitHub <noreply@github.com>2024-11-20 17:37:57 +0000
commitf76323e9b295c15751e51e3443aa47a36bee8023 (patch)
tree4113c8cad473a33e0f746966e0cf087252fa1d7a /yql/essentials/tests/sql/suites/pg
parent753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff)
parenta7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff)
downloadydb-f76323e9b295c15751e51e3443aa47a36bee8023.tar.gz
Merge pull request #11788 from ydb-platform/mergelibs-241120-1113
Library import 241120-1113
Diffstat (limited to 'yql/essentials/tests/sql/suites/pg')
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggr_compare.sql14
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_combine.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_combine.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_combine_all.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_combine_all.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_ctx.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_distinct.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_emit_agg_apply.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_factory.sql27
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_minus_zero.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_minus_zero.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/aggregate_scalar_minus_zero.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/all_data.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/all_data.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/all_data.txt2
-rw-r--r--yql/essentials/tests/sql/suites/pg/all_data.txt.attr35
-rw-r--r--yql/essentials/tests/sql/suites/pg/avg_float_clone_init_value.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/bit_const.sql1
-rw-r--r--yql/essentials/tests/sql/suites/pg/cast_int_to_bit.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/cbo_pragma1.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/cbo_pragma2.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/coalesce.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/compare.sql12
-rw-r--r--yql/essentials/tests/sql/suites/pg/current_database.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/dates_from_pg.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/dates_to_pg.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/def_column_name_func.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/default.cfg3
-rw-r--r--yql/essentials/tests/sql/suites/pg/distinct_all_projection.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/distinct_on_multi_projection.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_no_order.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_order.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_order_expr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/doubles_search_path.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/drop_table.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/drop_table.sql17
-rw-r--r--yql/essentials/tests/sql/suites/pg/equals_where_over_cross.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/equals_where_over_cross2.sql10
-rw-r--r--yql/essentials/tests/sql/suites/pg/expr_op_array.sql16
-rw-r--r--yql/essentials/tests/sql/suites/pg/in_mixed.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/in_mixed.sql21
-rw-r--r--yql/essentials/tests/sql/suites/pg/in_sorted.sql1
-rw-r--r--yql/essentials/tests/sql/suites/pg/input.txt4
-rw-r--r--yql/essentials/tests/sql/suites/pg/input.txt.attr5
-rw-r--r--yql/essentials/tests/sql/suites/pg/input2.txt3
-rw-r--r--yql/essentials/tests/sql/suites/pg/input2.txt.attr5
-rw-r--r--yql/essentials/tests/sql/suites/pg/input3.txt3
-rw-r--r--yql/essentials/tests/sql/suites/pg/input3.txt.attr5
-rw-r--r--yql/essentials/tests/sql/suites/pg/input4.txt3
-rw-r--r--yql/essentials/tests/sql/suites/pg/input4.txt.attr5
-rw-r--r--yql/essentials/tests/sql/suites/pg/input5.txt5
-rw-r--r--yql/essentials/tests/sql/suites/pg/input5.txt.attr5
-rw-r--r--yql/essentials/tests/sql/suites/pg/inputC.txt1
-rw-r--r--yql/essentials/tests/sql/suites/pg/inputC.txt.attr5
-rw-r--r--yql/essentials/tests/sql/suites/pg/inputZ.txt2
-rw-r--r--yql/essentials/tests/sql/suites/pg/inputZ.txt.attr5
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_1.txt4
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_1.txt.attr5
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_2.txt4
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_2.txt.attr5
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_3.txt4
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_3.txt.attr5
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_name.txt3
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_name.txt.attr6
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_pg.txt4
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_pg.txt.attr7
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_pg_int_and_text.txt4
-rw-r--r--yql/essentials/tests/sql/suites/pg/input_pg_int_and_text.txt.attr6
-rw-r--r--yql/essentials/tests/sql/suites/pg/insert.cfg2
-rw-r--r--yql/essentials/tests/sql/suites/pg/insert.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/interval_to_pg.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/is_predicate.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_brackets1.sql11
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_brackets2.sql21
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_groups.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_tree_order.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using1.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using2.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using3.sql12
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using4.sql12
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using5.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using6.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using7.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using8.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using9.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_case_insensetive1.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_case_insensetive2.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_multiple1.sql9
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_multiple2.cfg3
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_multiple2.sql9
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_multiple3.sql12
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_table_used_order.sql13
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_table_used_order1.sql10
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_table_used_order2.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_table_used_order2.sql10
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_tables1.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_tables2.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_tables3.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/join_using_tables4.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/lang_sql.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/long_ident.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/multi_usage_cross_join.sql13
-rw-r--r--yql/essentials/tests/sql/suites/pg/name.cfg2
-rw-r--r--yql/essentials/tests/sql/suites/pg/name.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/nothing.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/nullif.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/nulls.sql39
-rw-r--r--yql/essentials/tests/sql/suites/pg/nulls_native.sql40
-rw-r--r--yql/essentials/tests/sql/suites/pg/numbers_to_pg.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/numeric_to_pg.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_agg_extra_for_keys.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_aggr.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_full.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_keys.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_prj_and_aggr.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_prj_and_keys_and_aggr.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_agg_no_extra_for_aggs.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr_agg.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr_agg_sublink.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_input_columns.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_input_columns_qual.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_shadow_input_columns.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/order_by_shadow_input_columns_qual.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/palloc_big_string.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/param_text1.json1
-rw-r--r--yql/essentials/tests/sql/suites/pg/param_text2.json1
-rw-r--r--yql/essentials/tests/sql/suites/pg/parametrized.cfg2
-rw-r--r--yql/essentials/tests/sql/suites/pg/parametrized.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_array_cast.sql9
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_array_compare.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_array_literal.sql15
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_column_case.cfg2
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_column_case.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_corr_count.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_corr_limit.sql10
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_corr_offset.sql10
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_corr_sort_limit.sql11
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_corr_sort_limit2.sql13
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_in_dict_key_with_stable_pickle.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_in_expr.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_interval_literal.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_iterate.sql22
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_like.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_like.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_like_cast.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_like_opt.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_type_from_oid.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_aggregate1.sql80
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_array_literal.sql1
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_cast_with_length.sql9
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_dict.cfg4
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_dict.sql17
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_literal_mods.sql14
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_literal_with_length.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_orderby.cfg2
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_orderby.sql32
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_window1.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_types_window2.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/pg_view.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/pgns_agg.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/pgns_proc.sql1
-rw-r--r--yql/essentials/tests/sql/suites/pg/point.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/range_function_multi.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/range_function_multi_record.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/range_function_scalar.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/record_from_table_row.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/reflection.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/regoids.sql44
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_expr_having.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_expr_key_under_agg.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_expr_order.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_expr_projection.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_group.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_group_key_only.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_gs_cube.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_gs_grouping.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_gs_rollup.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_gs_sets.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_one_row.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_qstar.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_agg_star.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_alias_partial.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_and_or_group.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_between.sql11
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_case.sql20
-rwxr-xr-xyql/essentials/tests/sql/suites/pg/select_cast_same_arg.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_columnref1.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_columnref2.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_common_type_except.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_common_type_exceptall.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_common_type_if.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_common_type_intersect.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_common_type_intersectall.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_common_type_union.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_common_type_unionall.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_common_type_unionall.sql21
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_except.sql12
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_except_all.sql12
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_from_columns.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_from_columns_qstar.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_from_columns_scalar.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_from_columns_star.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_having.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_having_no_from.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_having_same_agg.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_intersect.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_intersect_all.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_is_null.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_cross.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_cross_and_inner.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_full.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_full3.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_full_const.sql32
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_full_equi.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_full_equi_and_const.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_full_equi_and_one.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_full_one.sql16
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_inner.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_inner3.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_inner_const.sql32
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_inner_equi.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_inner_equi_and_const.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_inner_equi_and_one.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_inner_one.sql16
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_left.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_left3.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_left_const.sql32
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_left_equi.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_left_equi_and_const.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_left_equi_and_one.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_left_one.sql16
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_qstar.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_right.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_right3.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_right_const.sql32
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_right_equi.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_right_equi_and_const.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_right_equi_and_one.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_join_right_one.sql16
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_limit.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_literals.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_plusminus.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_plusminus_unary.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_expr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_qstar.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_star.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_col.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_expr.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_qcol.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_qstar.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_star.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_expr.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_qstar.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_star.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_union_all_expr.sql10
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_qstarref1.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_qstarref2.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_sort_project_expr.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_sort_project_new.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_sort_project_same.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_sort_project_same_asc.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_sort_project_same_desc.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_starref1.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_starref2.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_subquery.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_subquery2.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_subquery2_qstar.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_subquery_scalar.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_subquery_scalar2.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_subquery_scalar2_qstar.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_substring.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_table1.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_table2.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_union.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_unionall_scalar.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_unionall_self.sql6
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_where.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_where_scalar.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_column_order_by.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_column_partition_by.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_count.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_count_all.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_cume_dist.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_expr_agg.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_expr_agg_order.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_expr_lead.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_expr_order.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_expr_partition.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_first_last_value.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_frame.sql18
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_lead_lag.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_max.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_max_null.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_min.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_min_null.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_nth_value.sql11
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_ntile.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_partition_sort.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_percent_rank.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_rank.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_rank_order.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_row_number.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_sum.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_win_sum_null.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_yql_type.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/select_yql_type.sql15
-rw-r--r--yql/essentials/tests/sql/suites/pg/set_of_as_records.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/set_of_as_records.sql1
-rw-r--r--yql/essentials/tests/sql/suites/pg/set_of_as_structs.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/set_over_unhashable.sql1
-rw-r--r--yql/essentials/tests/sql/suites/pg/simple_ops.sql18
-rw-r--r--yql/essentials/tests/sql/suites/pg/single_input_filter_over_join.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sort_nulls_priority.sql13
-rw-r--r--yql/essentials/tests/sql/suites/pg/sort_nulls_priority_window.sql13
-rw-r--r--yql/essentials/tests/sql/suites/pg/str_lookup_pg.sql22
-rw-r--r--yql/essentials/tests/sql/suites/pg/strings_to_pg.sql11
-rw-r--r--yql/essentials/tests/sql/suites/pg/struct_tuple_cast.sql9
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_columns_in_test_expr_columns.sql11
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_columns_in_test_expr_columns_corr.sql11
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_having_all.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_having_any.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_having_exists.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_having_expr.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_having_in.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_order_all_corr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_order_any_corr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_order_exists_corr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_order_expr_corr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_order_in_corr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_projection_all_corr.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_projection_any_corr.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_projection_array.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_projection_array_corr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_projection_exists_corr.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_projection_expr_corr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_projection_in_corr.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_projection_uncorrelated.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_where_all.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_where_all_corr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_where_any.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_where_any_corr.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_where_exists.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_where_exists_corr.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_where_expr.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_where_expr_corr.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_where_in.sql4
-rw-r--r--yql/essentials/tests/sql/suites/pg/sublink_where_in_corr.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/table_func.sql15
-rw-r--r--yql/essentials/tests/sql/suites/pg/type_aliases.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/unknown.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/uuid_from_pg.sql2
-rw-r--r--yql/essentials/tests/sql/suites/pg/values.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/variadic.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/variadic_array_arg.sql3
-rw-r--r--yql/essentials/tests/sql/suites/pg/wide_sort.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/wide_sort.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/wide_top_sort.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/pg/wide_top_sort.sql5
-rw-r--r--yql/essentials/tests/sql/suites/pg/with.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/with_rec_all.sql8
-rw-r--r--yql/essentials/tests/sql/suites/pg/with_rec_all_empty.sql9
-rw-r--r--yql/essentials/tests/sql/suites/pg/with_rec_distinct.sql7
-rw-r--r--yql/essentials/tests/sql/suites/pg/with_rec_trivial.sql5
365 files changed, 2354 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/pg/aggr_compare.sql b/yql/essentials/tests/sql/suites/pg/aggr_compare.sql
new file mode 100644
index 0000000000..e041d4e61a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggr_compare.sql
@@ -0,0 +1,14 @@
+$n = Nothing(pgint4);
+$n2 = Nothing(pgint4) + 0p;
+$a = 1p;
+$b = 2p;
+$b2 = 1p + 1p;
+select
+ AsStruct(Yql::AggrLess($a, $b) as x1, Yql::AggrLess($b, $a) as x2, Yql::AggrLess($b, $b2) as x3,
+ Yql::AggrLess($a, $n) as y1, Yql::AggrLess($n, $a) as y2, Yql::AggrLess($n, $n2) as y3),
+ AsStruct(Yql::AggrLessOrEqual($a, $b) as x1, Yql::AggrLessOrEqual($b, $a) as x2, Yql::AggrLessOrEqual($b, $b2) as x3,
+ Yql::AggrLessOrEqual($a, $n) as y1, Yql::AggrLessOrEqual($n, $a) as y2, Yql::AggrLessOrEqual($n, $n2) as y3),
+ AsStruct(Yql::AggrGreater($a, $b) as x1, Yql::AggrGreater($b, $a) as x2, Yql::AggrGreater($b, $b2) as x3,
+ Yql::AggrGreater($a, $n) as y1, Yql::AggrGreater($n, $a) as y2, Yql::AggrGreater($n, $n2) as y3),
+ AsStruct(Yql::AggrGreaterOrEqual($a, $b) as x1, Yql::AggrGreaterOrEqual($b, $a) as x2, Yql::AggrGreaterOrEqual($b, $b2) as x3,
+ Yql::AggrGreaterOrEqual($a, $n) as y1, Yql::AggrGreaterOrEqual($n, $a) as y2, Yql::AggrGreaterOrEqual($n, $n2) as y3),
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_combine.cfg b/yql/essentials/tests/sql/suites/pg/aggregate_combine.cfg
new file mode 100644
index 0000000000..e377e2a9ec
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_combine.cfg
@@ -0,0 +1 @@
+in Input3 input3.txt
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_combine.sql b/yql/essentials/tests/sql/suites/pg/aggregate_combine.sql
new file mode 100644
index 0000000000..2aaccbf7ce
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_combine.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select value,avg(key::int8)
+from plato."Input3"
+group by value
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_combine_all.cfg b/yql/essentials/tests/sql/suites/pg/aggregate_combine_all.cfg
new file mode 100644
index 0000000000..e377e2a9ec
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_combine_all.cfg
@@ -0,0 +1 @@
+in Input3 input3.txt
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_combine_all.sql b/yql/essentials/tests/sql/suites/pg/aggregate_combine_all.sql
new file mode 100644
index 0000000000..4c2def72ab
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_combine_all.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select avg(key::int8)
+from plato."Input3"
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_ctx.sql b/yql/essentials/tests/sql/suites/pg/aggregate_ctx.sql
new file mode 100644
index 0000000000..56edb9e18a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_ctx.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select string_agg(x,',') from (values ('a'),('b')) a(x);
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_distinct.sql b/yql/essentials/tests/sql/suites/pg/aggregate_distinct.sql
new file mode 100644
index 0000000000..d6391e5a85
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_distinct.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select string_agg(distinct x,y) from (values ('a',','),('b',':'),('a',',')) a(x,y);
+select count(distinct x) from (values (1),(2),(1),(3),(2),(1)) a(x); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_emit_agg_apply.sql b/yql/essentials/tests/sql/suites/pg/aggregate_emit_agg_apply.sql
new file mode 100644
index 0000000000..f3f663340c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_emit_agg_apply.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+set EmitAggApply=true;
+select string_agg(cast(x as text),',') from generate_series(1,2) as x
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_factory.sql b/yql/essentials/tests/sql/suites/pg/aggregate_factory.sql
new file mode 100644
index 0000000000..6fbe0119bd
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_factory.sql
@@ -0,0 +1,27 @@
+select
+Pg::string_agg(x,','p)
+from (values ('a'p),('b'p),('c'p)) as a(x);
+
+select
+Pg::string_agg(x,','p) over (order by x),
+from (values ('a'p),('b'p),('c'p)) as a(x);
+
+$agg_string_agg = AggregationFactory("Pg::string_agg");
+
+select
+AggregateBy((x,','p),$agg_string_agg)
+from (values ('a'p),('b'p),('c'p)) as a(x);
+
+select
+AggregateBy((x,','p),$agg_string_agg) over (order by x),
+from (values ('a'p),('b'p),('c'p)) as a(x);
+
+$agg_max = AggregationFactory("Pg::max");
+
+select
+AggregateBy(x,$agg_max)
+from (values ('a'p),('b'p),('c'p)) as a(x);
+
+select
+AggregateBy(x,$agg_max) over (order by x),
+from (values ('a'p),('b'p),('c'p)) as a(x);
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_minus_zero.cfg b/yql/essentials/tests/sql/suites/pg/aggregate_minus_zero.cfg
new file mode 100644
index 0000000000..0cdbb201f7
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_minus_zero.cfg
@@ -0,0 +1 @@
+in InputZ inputZ.txt
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_minus_zero.sql b/yql/essentials/tests/sql/suites/pg/aggregate_minus_zero.sql
new file mode 100644
index 0000000000..b4738cf99c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_minus_zero.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select x, count(*)
+from (
+select f::float8 as x from plato."InputZ"
+) a
+group by x
diff --git a/yql/essentials/tests/sql/suites/pg/aggregate_scalar_minus_zero.sql b/yql/essentials/tests/sql/suites/pg/aggregate_scalar_minus_zero.sql
new file mode 100644
index 0000000000..672e61a034
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/aggregate_scalar_minus_zero.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select x, count(*)
+from (
+select '+0.0'::float8 as x
+union all
+select '-0.0'::float8 as x
+) a
+group by x
diff --git a/yql/essentials/tests/sql/suites/pg/all_data.cfg b/yql/essentials/tests/sql/suites/pg/all_data.cfg
new file mode 100644
index 0000000000..5b191b093d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/all_data.cfg
@@ -0,0 +1 @@
+in Input all_data.txt
diff --git a/yql/essentials/tests/sql/suites/pg/all_data.sql b/yql/essentials/tests/sql/suites/pg/all_data.sql
new file mode 100644
index 0000000000..cab5016734
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/all_data.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from plato."Input";
diff --git a/yql/essentials/tests/sql/suites/pg/all_data.txt b/yql/essentials/tests/sql/suites/pg/all_data.txt
new file mode 100644
index 0000000000..311847daa5
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/all_data.txt
@@ -0,0 +1,2 @@
+{}
+
diff --git a/yql/essentials/tests/sql/suites/pg/all_data.txt.attr b/yql/essentials/tests/sql/suites/pg/all_data.txt.attr
new file mode 100644
index 0000000000..f2e081cdfe
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/all_data.txt.attr
@@ -0,0 +1,35 @@
+{"_yql_row_spec"={
+ "Type"=["StructType";[
+ ["Bool";["OptionalType";["DataType";"Bool"]]];
+ ["Int8";["OptionalType";["DataType";"Int8"]]];
+ ["Uint8";["OptionalType";["DataType";"Uint8"]]];
+ ["Int16";["OptionalType";["DataType";"Int16"]]];
+ ["Uint16";["OptionalType";["DataType";"Uint16"]]];
+ ["Int32";["OptionalType";["DataType";"Int32"]]];
+ ["Uint32";["OptionalType";["DataType";"Uint32"]]];
+ ["Int64";["OptionalType";["DataType";"Int64"]]];
+ ["Uint64";["OptionalType";["DataType";"Uint64"]]];
+ ["Double";["OptionalType";["DataType";"Double"]]];
+ ["Float";["OptionalType";["DataType";"Float"]]];
+ ["String";["OptionalType";["DataType";"String"]]];
+ ["Utf8";["OptionalType";["DataType";"Utf8"]]];
+ ["Yson";["OptionalType";["DataType";"Yson"]]];
+ ["Json";["OptionalType";["DataType";"Json"]]];
+ ["Uuid";["OptionalType";["DataType";"Uuid"]]];
+ ["Date";["OptionalType";["DataType";"Date"]]];
+ ["Datetime";["OptionalType";["DataType";"Datetime"]]];
+ ["Timestamp";["OptionalType";["DataType";"Timestamp"]]];
+ ["Interval";["OptionalType";["DataType";"Interval"]]];
+ ["TzDate";["OptionalType";["DataType";"TzDate"]]];
+ ["TzDatetime";["OptionalType";["DataType";"TzDatetime"]]];
+ ["TzTimestamp";["OptionalType";["DataType";"TzTimestamp"]]];
+ ["Decimal";["OptionalType";["DataType";"Decimal";"10";"1"]]];
+ ["DyNumber";["OptionalType";["DataType";"DyNumber"]]];
+ ["JsonDocument";["OptionalType";["DataType";"JsonDocument"]]];
+ ["Date32";["OptionalType";["DataType";"Date32"]]];
+ ["Datetime64";["OptionalType";["DataType";"Datetime64"]]];
+ ["Timestamp64";["OptionalType";["DataType";"Timestamp64"]]];
+ ["Interval64";["OptionalType";["DataType";"Interval64"]]];
+ ]];
+}}
+
diff --git a/yql/essentials/tests/sql/suites/pg/avg_float_clone_init_value.sql b/yql/essentials/tests/sql/suites/pg/avg_float_clone_init_value.sql
new file mode 100644
index 0000000000..cc7f21571b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/avg_float_clone_init_value.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select avg(x) ax, avg(y) ay from (values (1.0,2.0),(3.0,4.0)) as a(x,y)
+
diff --git a/yql/essentials/tests/sql/suites/pg/bit_const.sql b/yql/essentials/tests/sql/suites/pg/bit_const.sql
new file mode 100644
index 0000000000..89190d29ad
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/bit_const.sql
@@ -0,0 +1 @@
+select PgConst('101',pgbit,2),PgConst('{101,111}',_pgbit,2) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/cast_int_to_bit.sql b/yql/essentials/tests/sql/suites/pg/cast_int_to_bit.sql
new file mode 100644
index 0000000000..eb4b52ae10
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/cast_int_to_bit.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select array[44,44]::_bit(10), 44::bit(10)
diff --git a/yql/essentials/tests/sql/suites/pg/cbo_pragma1.sql b/yql/essentials/tests/sql/suites/pg/cbo_pragma1.sql
new file mode 100644
index 0000000000..497fdc6ed1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/cbo_pragma1.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+set CostBasedOptimizer="PG";
+select 1;
diff --git a/yql/essentials/tests/sql/suites/pg/cbo_pragma2.sql b/yql/essentials/tests/sql/suites/pg/cbo_pragma2.sql
new file mode 100644
index 0000000000..5cf8cbf560
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/cbo_pragma2.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+set CostBasedOptimizer="native";
+select 1;
diff --git a/yql/essentials/tests/sql/suites/pg/coalesce.sql b/yql/essentials/tests/sql/suites/pg/coalesce.sql
new file mode 100644
index 0000000000..0b7018990a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/coalesce.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select coalesce(1,2),coalesce(x,2),coalesce(x,y,z) from
+(
+select null::int4 as x, null::int4 as y, 6 as z
+) a \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/compare.sql b/yql/essentials/tests/sql/suites/pg/compare.sql
new file mode 100644
index 0000000000..15cfebfab4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/compare.sql
@@ -0,0 +1,12 @@
+select
+1p < 2p, 1p <= 2p, cast(null as pgint4) < 1p, cast(null as pgint4) <= 1p,
+1p = 2p, 1p != 2p, cast(null as pgint4) = 1p, cast(null as pgint4) != 1p,
+1p > 2p, 1p >= 2p, cast(null as pgint4) > 1p, cast(null as pgint4) >= 1p,
+1p is distinct from 2p,
+1p is not distinct from 2p,
+cast(null as pgint4) is distinct from cast(null as pgint4),
+cast(null as pgint4) is not distinct from cast(null as pgint4),
+1p is distinct from cast(null as pgint4),
+1p is not distinct from cast(null as pgint4),
+cast(null as pgint4) is distinct from 1p,
+cast(null as pgint4) is not distinct from 1p;
diff --git a/yql/essentials/tests/sql/suites/pg/current_database.sql b/yql/essentials/tests/sql/suites/pg/current_database.sql
new file mode 100644
index 0000000000..c9542c10c0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/current_database.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select current_database();
+
diff --git a/yql/essentials/tests/sql/suites/pg/dates_from_pg.sql b/yql/essentials/tests/sql/suites/pg/dates_from_pg.sql
new file mode 100644
index 0000000000..b96bbce8c4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/dates_from_pg.sql
@@ -0,0 +1,3 @@
+select
+ FromPg(pgdate('148107-12-31')),FromPg(pgdate('4714-11-24BC')),FromPg(pgdate('5874897-12-31')),
+ FromPg(pgtimestamp('148107-12-31 01:02:03')),FromPg(pgtimestamp('4714-11-24BC 01:02:03')),FromPg(pgtimestamp('294276-12-31 01:02:03'));
diff --git a/yql/essentials/tests/sql/suites/pg/dates_to_pg.sql b/yql/essentials/tests/sql/suites/pg/dates_to_pg.sql
new file mode 100644
index 0000000000..df359f5fc1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/dates_to_pg.sql
@@ -0,0 +1,7 @@
+select ToPg(date("1970-01-01")),ToPg(date("2105-12-31")),
+ ToPg(datetime("1970-01-01T00:00:00Z")),ToPg(datetime("2105-12-31T23:59:59Z")),
+ ToPg(timestamp("1970-01-01T00:00:00.000000Z")),ToPg(timestamp("2105-12-31T23:59:59.999999Z")),
+ ToPg(date32("-4714-11-24")),ToPg(date32("148107-12-31")),
+ ToPg(datetime64("-4714-11-24T00:00:00Z")),ToPg(datetime64("148107-12-31T23:59:59Z")),
+ ToPg(timestamp64("-4714-11-24T00:00:00.000000Z")),ToPg(timestamp64("148107-12-31T23:59:59.999999Z"));
+ \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/def_column_name_func.sql b/yql/essentials/tests/sql/suites/pg/def_column_name_func.sql
new file mode 100644
index 0000000000..c0d4e7361c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/def_column_name_func.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select upper('a');
+
diff --git a/yql/essentials/tests/sql/suites/pg/default.cfg b/yql/essentials/tests/sql/suites/pg/default.cfg
new file mode 100644
index 0000000000..1e0c12cac0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/default.cfg
@@ -0,0 +1,3 @@
+in Input input.txt
+in Input2 input2.txt
+in Input5 input5.txt \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/distinct_all_projection.sql b/yql/essentials/tests/sql/suites/pg/distinct_all_projection.sql
new file mode 100644
index 0000000000..f0453afde4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/distinct_all_projection.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select distinct x from (values (1),(2),(1),(null::int4)) a(x)
diff --git a/yql/essentials/tests/sql/suites/pg/distinct_on_multi_projection.sql b/yql/essentials/tests/sql/suites/pg/distinct_on_multi_projection.sql
new file mode 100644
index 0000000000..60b4e4577f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/distinct_on_multi_projection.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select 10 as u,20 as v
+union all
+select distinct on (x) x,y
+from (values (1,1),(1,2),(2,5),(2,4)) a(x,y)
+order by u,v desc
diff --git a/yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_no_order.sql b/yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_no_order.sql
new file mode 100644
index 0000000000..83f5751d1f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_no_order.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select distinct on (x) x,y
+from (values (1,1),(1,2),(2,5),(2,4)) a(x,y)
+
diff --git a/yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_order.sql b/yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_order.sql
new file mode 100644
index 0000000000..18cfde2324
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_order.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select distinct on (x) x,y
+from (values (1,1),(1,2),(2,5),(2,4)) a(x,y)
+order by x,y desc
diff --git a/yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_order_expr.sql b/yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_order_expr.sql
new file mode 100644
index 0000000000..2736b0ff26
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/distinct_on_single_projection_order_expr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select distinct on (x/3) x,y
+from (values (1,1),(1,2),(2,5),(2,4)) a(x,y)
+order by x/3,y desc
diff --git a/yql/essentials/tests/sql/suites/pg/doubles_search_path.sql b/yql/essentials/tests/sql/suites/pg/doubles_search_path.sql
new file mode 100644
index 0000000000..f35d89bdca
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/doubles_search_path.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+SET search_path = "public", public;
+select count(*) from plato."Input";
diff --git a/yql/essentials/tests/sql/suites/pg/drop_table.cfg b/yql/essentials/tests/sql/suites/pg/drop_table.cfg
new file mode 100644
index 0000000000..9b85bd0ae8
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/drop_table.cfg
@@ -0,0 +1 @@
+out Output output.txt
diff --git a/yql/essentials/tests/sql/suites/pg/drop_table.sql b/yql/essentials/tests/sql/suites/pg/drop_table.sql
new file mode 100644
index 0000000000..7a3549cd75
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/drop_table.sql
@@ -0,0 +1,17 @@
+--!syntax_pg
+
+insert into plato."Output"
+SELECT 1;
+
+commit;
+
+drop table plato."Output";
+
+commit;
+
+insert into plato."Output"
+SELECT 'foo';
+
+commit;
+
+drop table plato."Output";
diff --git a/yql/essentials/tests/sql/suites/pg/equals_where_over_cross.sql b/yql/essentials/tests/sql/suites/pg/equals_where_over_cross.sql
new file mode 100644
index 0000000000..8914889178
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/equals_where_over_cross.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (select 1 as x) as a
+, (select 1 as y) as b
+, (select 1 as z) as c
+where
+a.x = c.z
+and
+a.x = b.y
diff --git a/yql/essentials/tests/sql/suites/pg/equals_where_over_cross2.sql b/yql/essentials/tests/sql/suites/pg/equals_where_over_cross2.sql
new file mode 100644
index 0000000000..f46adbefb1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/equals_where_over_cross2.sql
@@ -0,0 +1,10 @@
+--!syntax_pg
+select * from (select 1 as x, 2 as w) as a
+, (select 1 as y, 2 as v) as b
+, (select 1 as z) as c
+where
+a.x = c.z
+and
+a.x = b.y
+and
+a.w = b.v
diff --git a/yql/essentials/tests/sql/suites/pg/expr_op_array.sql b/yql/essentials/tests/sql/suites/pg/expr_op_array.sql
new file mode 100644
index 0000000000..b70da9fc1b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/expr_op_array.sql
@@ -0,0 +1,16 @@
+--!syntax_pg
+select 1 = any(array[1,2]),
+ 1 = any(array[2,3]),
+ 2 = all(array[2,2]),
+ 2 = all(array[2,3]),
+ 1 = any(array[null,1]),
+ 1 = any(array[null,2]),
+ 1 = all(array[null,1]),
+ 1 = any(null::_int4),
+ 1 = all(null::_int4),
+ null = any(array[1,2]),
+ null = all(array[1,2]),
+ null = any(null::_int4),
+ null = all(null::_int4);
+
+
diff --git a/yql/essentials/tests/sql/suites/pg/in_mixed.cfg b/yql/essentials/tests/sql/suites/pg/in_mixed.cfg
new file mode 100644
index 0000000000..0ca1ef5bf1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/in_mixed.cfg
@@ -0,0 +1 @@
+in Input input_name.txt
diff --git a/yql/essentials/tests/sql/suites/pg/in_mixed.sql b/yql/essentials/tests/sql/suites/pg/in_mixed.sql
new file mode 100644
index 0000000000..b25173295c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/in_mixed.sql
@@ -0,0 +1,21 @@
+--!syntax_pg
+
+-- simple case
+select 1 in ('1', '2');
+
+-- splits into IN over numerics and IN over text
+select '1' in (0, 0.0, 1, '1'::text, '3'::char(3));
+
+-- mixture of types in rhs, expression in lhs
+select (c::int + 1) in (1, 2.9, '4') from (values ('0'), ('1')) as t(c);
+
+-- arrays support
+select array[1, 2] in (array[2, 4], array[1, 2]);
+
+-- NULL in rhs
+select 1 in (0, NULL);
+select 1 in ('1', NULL);
+
+-- non-PG types handling
+select index in ('2', 4) from plato."Input";
+
diff --git a/yql/essentials/tests/sql/suites/pg/in_sorted.sql b/yql/essentials/tests/sql/suites/pg/in_sorted.sql
new file mode 100644
index 0000000000..5569d18fc3
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/in_sorted.sql
@@ -0,0 +1 @@
+select pgbit('0001') in (pgbit('0001'),pgbit('0010')) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/input.txt b/yql/essentials/tests/sql/suites/pg/input.txt
new file mode 100644
index 0000000000..65949ea745
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input.txt
@@ -0,0 +1,4 @@
+{"key"="075";"subkey"="1";"value"="abc"};
+{"key"="800";"subkey"="2";"value"="ddd"};
+{"key"="020";"subkey"="3";"value"="q"};
+{"key"="150";"subkey"="4";"value"="qzz"};
diff --git a/yql/essentials/tests/sql/suites/pg/input.txt.attr b/yql/essentials/tests/sql/suites/pg/input.txt.attr
new file mode 100644
index 0000000000..29966e9729
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input.txt.attr
@@ -0,0 +1,5 @@
+{
+ "_yql_row_spec"={
+ "Type"=["StructType";[["key";["PgType";"text";];];["subkey";["PgType";"text";];];["value";["PgType";"text";];];];];
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/pg/input2.txt b/yql/essentials/tests/sql/suites/pg/input2.txt
new file mode 100644
index 0000000000..0667916f57
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input2.txt
@@ -0,0 +1,3 @@
+{"key2"="075";"subkey2"="1";"value2"="ABC"};
+{"key2"="800";"subkey2"="2";"value2"="DDD"};
+{"key2"="020";"subkey2"="3";"value2"="Q"};
diff --git a/yql/essentials/tests/sql/suites/pg/input2.txt.attr b/yql/essentials/tests/sql/suites/pg/input2.txt.attr
new file mode 100644
index 0000000000..764e188c0e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input2.txt.attr
@@ -0,0 +1,5 @@
+{
+ "_yql_row_spec"={
+ "Type"=["StructType";[["key2";["PgType";"text";];];["subkey2";["PgType";"text";];];["value2";["PgType";"text";];];];];
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/pg/input3.txt b/yql/essentials/tests/sql/suites/pg/input3.txt
new file mode 100644
index 0000000000..f489ef07c6
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input3.txt
@@ -0,0 +1,3 @@
+{"key"="1";"subkey"="3";"value"="aaa"};
+{"key"="2";"subkey"="5";"value"="aaa"};
+{"key"="3";"subkey"="1";"value"="bbb"};
diff --git a/yql/essentials/tests/sql/suites/pg/input3.txt.attr b/yql/essentials/tests/sql/suites/pg/input3.txt.attr
new file mode 100644
index 0000000000..29966e9729
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input3.txt.attr
@@ -0,0 +1,5 @@
+{
+ "_yql_row_spec"={
+ "Type"=["StructType";[["key";["PgType";"text";];];["subkey";["PgType";"text";];];["value";["PgType";"text";];];];];
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/pg/input4.txt b/yql/essentials/tests/sql/suites/pg/input4.txt
new file mode 100644
index 0000000000..9ca7e736b6
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input4.txt
@@ -0,0 +1,3 @@
+{"b_val"="true";"i_val"="3";"d_val"="2000-01-01"};
+{"b_val"="false";"i_val"="5";"d_val"="1979-12-12"};
+{"b_val"="true";"i_val"="1";"d_val"="2010-12-01"};
diff --git a/yql/essentials/tests/sql/suites/pg/input4.txt.attr b/yql/essentials/tests/sql/suites/pg/input4.txt.attr
new file mode 100644
index 0000000000..cbd95f44d0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input4.txt.attr
@@ -0,0 +1,5 @@
+{
+ "_yql_row_spec"={
+ "Type"=["StructType";[["b_val";["PgType";"text";];];["i_val";["PgType";"text";];];["d_val";["PgType";"text";];];];];
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/pg/input5.txt b/yql/essentials/tests/sql/suites/pg/input5.txt
new file mode 100644
index 0000000000..3d8c1dee24
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input5.txt
@@ -0,0 +1,5 @@
+{"key"="150";"subkey"="8";"value"="zzz"};
+{"key"="200";"subkey"="7";"value"="qqq"};
+{"key"="527";"subkey"="4";"value"="bbb"};
+{"key"="761";"subkey"="6";"value"="ccc"};
+{"key"="911";"subkey"="2";"value"="kkk"};
diff --git a/yql/essentials/tests/sql/suites/pg/input5.txt.attr b/yql/essentials/tests/sql/suites/pg/input5.txt.attr
new file mode 100644
index 0000000000..29966e9729
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input5.txt.attr
@@ -0,0 +1,5 @@
+{
+ "_yql_row_spec"={
+ "Type"=["StructType";[["key";["PgType";"text";];];["subkey";["PgType";"text";];];["value";["PgType";"text";];];];];
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/pg/inputC.txt b/yql/essentials/tests/sql/suites/pg/inputC.txt
new file mode 100644
index 0000000000..9b2963ca66
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/inputC.txt
@@ -0,0 +1 @@
+{"id"="1";"CodeGen_FullTime"="infinity"};
diff --git a/yql/essentials/tests/sql/suites/pg/inputC.txt.attr b/yql/essentials/tests/sql/suites/pg/inputC.txt.attr
new file mode 100644
index 0000000000..04395da84e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/inputC.txt.attr
@@ -0,0 +1,5 @@
+{
+ "_yql_row_spec"={
+ "Type"=["StructType";[["id";["PgType";"text";];];["CodeGen_FullTime";["PgType";"text";];];];];
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/pg/inputZ.txt b/yql/essentials/tests/sql/suites/pg/inputZ.txt
new file mode 100644
index 0000000000..6379112ef3
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/inputZ.txt
@@ -0,0 +1,2 @@
+{"f"="+0.0"};
+{"f"="-0.0"};
diff --git a/yql/essentials/tests/sql/suites/pg/inputZ.txt.attr b/yql/essentials/tests/sql/suites/pg/inputZ.txt.attr
new file mode 100644
index 0000000000..7a0736147d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/inputZ.txt.attr
@@ -0,0 +1,5 @@
+{
+ "_yql_row_spec"={
+ "Type"=["StructType";[["f";["PgType";"text";];];];];
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/pg/input_1.txt b/yql/essentials/tests/sql/suites/pg/input_1.txt
new file mode 100644
index 0000000000..9c4f4416e8
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_1.txt
@@ -0,0 +1,4 @@
+{"id"="000";"name"="vera"};
+{"id"="001";"name"="nadezhda"};
+{"id"="002";"name"="lubov"};
+{"id"="003";"name"="mashina"};
diff --git a/yql/essentials/tests/sql/suites/pg/input_1.txt.attr b/yql/essentials/tests/sql/suites/pg/input_1.txt.attr
new file mode 100644
index 0000000000..4eb7921afd
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_1.txt.attr
@@ -0,0 +1,5 @@
+{
+ "_yql_row_spec"={
+ "Type"=["StructType";[["id";["PgType";"text";];];["name";["PgType";"text";];];];];
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/pg/input_2.txt b/yql/essentials/tests/sql/suites/pg/input_2.txt
new file mode 100644
index 0000000000..1fb956089f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_2.txt
@@ -0,0 +1,4 @@
+{"id"="000";"no"="A001TX77"};
+{"id"="001";"no"="B002KK76"};
+{"id"="002";"no"="C003AE78"};
+{"id"="003";"no"="B777OP777"};
diff --git a/yql/essentials/tests/sql/suites/pg/input_2.txt.attr b/yql/essentials/tests/sql/suites/pg/input_2.txt.attr
new file mode 100644
index 0000000000..e13fdd2707
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_2.txt.attr
@@ -0,0 +1,5 @@
+{
+ "_yql_row_spec"={
+ "Type"=["StructType";[["id";["PgType";"text";];];["no";["PgType";"text";];];];];
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/pg/input_3.txt b/yql/essentials/tests/sql/suites/pg/input_3.txt
new file mode 100644
index 0000000000..cea60db303
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_3.txt
@@ -0,0 +1,4 @@
+{"id"="000";"sname"="lodkovna"};
+{"id"="001";"sname"="korableva"};
+{"id"="002";"sname"="sudnovna"};
+{"id"="003";"sname"="vremeni"};
diff --git a/yql/essentials/tests/sql/suites/pg/input_3.txt.attr b/yql/essentials/tests/sql/suites/pg/input_3.txt.attr
new file mode 100644
index 0000000000..236c665843
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_3.txt.attr
@@ -0,0 +1,5 @@
+{
+ "_yql_row_spec"={
+ "Type"=["StructType";[["id";["PgType";"text";];];["sname";["PgType";"text";];];];];
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/pg/input_name.txt b/yql/essentials/tests/sql/suites/pg/input_name.txt
new file mode 100644
index 0000000000..096cfb7e19
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_name.txt
@@ -0,0 +1,3 @@
+{"key"="foo";index=1};
+{"key"="bar";index=2};
+{"key"="baz";index=3};
diff --git a/yql/essentials/tests/sql/suites/pg/input_name.txt.attr b/yql/essentials/tests/sql/suites/pg/input_name.txt.attr
new file mode 100644
index 0000000000..8ec2d4d44b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_name.txt.attr
@@ -0,0 +1,6 @@
+{"_yql_row_spec"={
+ "Type"=["StructType";[
+ ["key";["PgType";"name"]];
+ ["index";["DataType";"Int32"]];
+ ]];
+}}
diff --git a/yql/essentials/tests/sql/suites/pg/input_pg.txt b/yql/essentials/tests/sql/suites/pg/input_pg.txt
new file mode 100644
index 0000000000..25433188f6
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_pg.txt
@@ -0,0 +1,4 @@
+{"a"=1;"b"="aaa";"c"="\0\0\0\1\0\0\0\0\0\0\0\x15\0\0\0\2\0\0\0\1\0\0\0\2\0\1\0\0\0\2\0\2"};
+{"a"=1;"b"="ddd";"c"="\0\0\0\1\0\0\0\0\0\0\0\x15\0\0\0\2\0\0\0\1\0\0\0\2\0\1\0\0\0\2\0\3"};
+{"a"=2;"b"="bbb";"c"="\0\0\0\1\0\0\0\0\0\0\0\x15\0\0\0\2\0\0\0\1\0\0\0\2\0\1\0\0\0\2\0\2"};
+{"a"=2;"b"="ccc";"c"="\0\0\0\1\0\0\0\0\0\0\0\x15\0\0\0\2\0\0\0\1\0\0\0\2\0\1\0\0\0\2\0\3"};
diff --git a/yql/essentials/tests/sql/suites/pg/input_pg.txt.attr b/yql/essentials/tests/sql/suites/pg/input_pg.txt.attr
new file mode 100644
index 0000000000..aa9ffac476
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_pg.txt.attr
@@ -0,0 +1,7 @@
+{"_yql_row_spec"={
+ "Type"=["StructType";[
+ ["a";["PgType";"int2"]];
+ ["b";["PgType";"text"]];
+ ["c";["PgType";"_int2"]];
+ ]];
+}} \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/input_pg_int_and_text.txt b/yql/essentials/tests/sql/suites/pg/input_pg_int_and_text.txt
new file mode 100644
index 0000000000..79d59e9d3f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_pg_int_and_text.txt
@@ -0,0 +1,4 @@
+{"a"=1;"b"="aaa"};
+{"a"=1;"b"="bbb"};
+{"a"=2;"b"=#};
+{"a"=2;"b"="ccc"};
diff --git a/yql/essentials/tests/sql/suites/pg/input_pg_int_and_text.txt.attr b/yql/essentials/tests/sql/suites/pg/input_pg_int_and_text.txt.attr
new file mode 100644
index 0000000000..f10676fc0e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/input_pg_int_and_text.txt.attr
@@ -0,0 +1,6 @@
+{"_yql_row_spec"={
+ "Type"=["StructType";[
+ ["a";["PgType";"int2"]];
+ ["b";["PgType";"text"]];
+ ]];
+}}
diff --git a/yql/essentials/tests/sql/suites/pg/insert.cfg b/yql/essentials/tests/sql/suites/pg/insert.cfg
new file mode 100644
index 0000000000..de341b36d1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/insert.cfg
@@ -0,0 +1,2 @@
+in Input input.txt
+out Output output.txt \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/insert.sql b/yql/essentials/tests/sql/suites/pg/insert.sql
new file mode 100644
index 0000000000..25ed958fea
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/insert.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+insert into plato."Output"
+select * from plato."Input" \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/interval_to_pg.sql b/yql/essentials/tests/sql/suites/pg/interval_to_pg.sql
new file mode 100644
index 0000000000..f06adefdce
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/interval_to_pg.sql
@@ -0,0 +1,3 @@
+select ToPg(cast(0 as interval)),ToPg(cast(4291747199999999l as interval)),ToPg(cast(-4291747199999999l as interval)),
+ ToPg(cast(0 as interval64)),ToPg(cast(9223339708799999999l as interval64)),ToPg(cast(-9223339708799999999l as interval64));
+
diff --git a/yql/essentials/tests/sql/suites/pg/is_predicate.sql b/yql/essentials/tests/sql/suites/pg/is_predicate.sql
new file mode 100644
index 0000000000..c13e0e4e4e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/is_predicate.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+select c,
+ c is true as "true", c is not true as "~true",
+ c is false as "false", c is not false as "~false",
+ c is unknown as "unk", c is not unknown as "~unk"
+from (values (true), (false), (null)) as t(c)
+
diff --git a/yql/essentials/tests/sql/suites/pg/join_brackets1.sql b/yql/essentials/tests/sql/suites/pg/join_brackets1.sql
new file mode 100644
index 0000000000..8604642809
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_brackets1.sql
@@ -0,0 +1,11 @@
+--!syntax_pg
+select * from
+(select 1 as foo) a
+join
+(select 2 as bar) b
+on a.foo + 1= b.bar
+join
+((select 3 as x) c
+join
+(select 4 as y) d
+on c.x=d.y-1) on a.foo=c.x-2 and b.bar=d.y-2 \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_brackets2.sql b/yql/essentials/tests/sql/suites/pg/join_brackets2.sql
new file mode 100644
index 0000000000..8d665392ca
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_brackets2.sql
@@ -0,0 +1,21 @@
+--!syntax_pg
+SELECT DISTINCT att.attname as name, att.attnum as OID, pg_catalog.format_type(ty.oid,NULL) AS datatype,
+att.attnotnull as not_null, att.atthasdef as has_default_val, des.description, seq.seqtypid
+FROM pg_catalog.pg_attribute att
+ JOIN pg_catalog.pg_type ty ON ty.oid=atttypid
+ JOIN pg_catalog.pg_namespace tn ON tn.oid=ty.typnamespace
+ JOIN pg_catalog.pg_class cl ON cl.oid=att.attrelid
+ JOIN pg_catalog.pg_namespace na ON na.oid=cl.relnamespace
+ LEFT OUTER JOIN pg_catalog.pg_type et ON et.oid=ty.typelem
+ LEFT OUTER JOIN pg_catalog.pg_attrdef def ON adrelid=att.attrelid AND adnum=att.attnum
+ LEFT OUTER JOIN (pg_catalog.pg_depend JOIN pg_catalog.pg_class cs ON classid='pg_class'::regclass AND objid=cs.oid AND cs.relkind='S') ON refobjid=att.attrelid AND refobjsubid::int4=att.attnum
+ LEFT OUTER JOIN pg_catalog.pg_namespace ns ON ns.oid=cs.relnamespace
+ LEFT OUTER JOIN pg_catalog.pg_index pi ON pi.indrelid=att.attrelid AND indisprimary
+ LEFT OUTER JOIN pg_catalog.pg_description des ON (des.objoid=att.attrelid AND des.objsubid::int4=att.attnum AND des.classoid='pg_class'::regclass)
+ LEFT OUTER JOIN pg_catalog.pg_sequence seq ON cs.oid=seq.seqrelid
+WHERE
+
+ att.attrelid = 12302::oid
+ AND att.attnum > 0
+ AND att.attisdropped IS FALSE
+ORDER BY att.attnum
diff --git a/yql/essentials/tests/sql/suites/pg/join_groups.sql b/yql/essentials/tests/sql/suites/pg/join_groups.sql
new file mode 100644
index 0000000000..1e7f89d425
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_groups.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select 1 from
+(select 1 as foo) a, (select 2 as foo) b
+left join
+(select 1 as bar) c
+on b.foo=c.bar \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_tree_order.sql b/yql/essentials/tests/sql/suites/pg/join_tree_order.sql
new file mode 100644
index 0000000000..abe6339431
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_tree_order.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+SELECT DISTINCT cs.oid
+FROM pg_catalog.pg_attribute att
+JOIN (pg_catalog.pg_depend JOIN pg_catalog.pg_class cs ON objid=cs.oid) ON refobjid=att.attrelid \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using1.sql b/yql/essentials/tests/sql/suites/pg/join_using1.sql
new file mode 100644
index 0000000000..34b4aaa99a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using1.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select c.fooo from (
+ (select 1 as fooo, 1 as x
+ union all
+ select 1 as fooo, 2 as y) c
+ join
+ (select 1 as fooo, 3 as xy) d
+ using(fooo)) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using2.sql b/yql/essentials/tests/sql/suites/pg/join_using2.sql
new file mode 100644
index 0000000000..533aa654e3
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using2.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (
+ (select 1 as fooo, 1 as x
+ union all
+ select 1 as fooo, 2 as y) c
+ join
+ (select 1 as fooo, 3 as xy) d
+ using(fooo)) order by x \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using3.sql b/yql/essentials/tests/sql/suites/pg/join_using3.sql
new file mode 100644
index 0000000000..b0d66de17d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using3.sql
@@ -0,0 +1,12 @@
+--!syntax_pg
+select * from (
+ (select 2 as foo) a
+ join
+ (select 2 as bar) b
+ on(a.foo = b.bar)), (
+ (select 1 as fooo, 1 as x
+ union all
+ select 1 as fooo, 2 as y) c
+ join
+ (select 1 as fooo) d
+ using(fooo)) order by x \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using4.sql b/yql/essentials/tests/sql/suites/pg/join_using4.sql
new file mode 100644
index 0000000000..849dd6fcc2
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using4.sql
@@ -0,0 +1,12 @@
+--!syntax_pg
+select * from (
+ (select 1 as fooo, 1 as x
+ union all
+ select 1 as fooo, 2 as y) c
+ join
+ (select 1 as fooo) d
+ using(fooo)),(
+ (select 2 as foo) a
+ join
+ (select 2 as bar) b
+ on(a.foo = b.bar)) order by x \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using5.sql b/yql/essentials/tests/sql/suites/pg/join_using5.sql
new file mode 100644
index 0000000000..d10ff2ada4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using5.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select c.fooo from (
+ (select 1 as fooo) c
+ full join
+ (select 2 as fooo) d
+ using(fooo)) order by fooo \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using6.sql b/yql/essentials/tests/sql/suites/pg/join_using6.sql
new file mode 100644
index 0000000000..e8b6d17f91
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using6.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select * from (
+ (select 1 as fooo) c
+ full join
+ (select 2 as fooo) d
+ using(fooo)) order by fooo \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using7.sql b/yql/essentials/tests/sql/suites/pg/join_using7.sql
new file mode 100644
index 0000000000..04bba587b0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using7.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select c.* from (
+ (select 1 as fooo, 1 as x
+ union all
+ select 1 as fooo, 2 as y) c
+ join
+ (select 1 as fooo, 3 as xy) d
+ using(fooo)) order by x \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using8.sql b/yql/essentials/tests/sql/suites/pg/join_using8.sql
new file mode 100644
index 0000000000..917bb57631
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using8.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select c.fooo as x, d.fooo as y from (
+ (select 1 as fooo, 1 as x) c
+ full join
+ (select 2 as fooo, 3 as xy) d
+ using(fooo)) order by x, y \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using9.sql b/yql/essentials/tests/sql/suites/pg/join_using9.sql
new file mode 100644
index 0000000000..c5d9eb14e6
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using9.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select c.*, fooo as b from (
+ (select 1 as fooo, 1 as x
+ union all
+ select 1 as fooo, 2 as y) c
+ join
+ (select 1 as fooo, 3 as xy) d
+ using(fooo)) order by x \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_case_insensetive1.sql b/yql/essentials/tests/sql/suites/pg/join_using_case_insensetive1.sql
new file mode 100644
index 0000000000..1b4426f70f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_case_insensetive1.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select * from (
+ (select 1 as FOO) c
+ join
+ (select 1 as foo) d
+ using(Foo)) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_case_insensetive2.sql b/yql/essentials/tests/sql/suites/pg/join_using_case_insensetive2.sql
new file mode 100644
index 0000000000..59e95d4247
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_case_insensetive2.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select c.FOO as a, d.* from (
+ (select 1 as FOO) c
+ join
+ (select 1 as foo) d
+ using(Foo)) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_multiple1.sql b/yql/essentials/tests/sql/suites/pg/join_using_multiple1.sql
new file mode 100644
index 0000000000..5866a9102e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_multiple1.sql
@@ -0,0 +1,9 @@
+--!syntax_pg
+select a.fooo as x, b.fooo as y, c.fooo as z, fooo from (
+ (select 1 as fooo) a
+ full join
+ (select 2 as fooo) b
+ using (fooo)
+ full join
+ (select 3 as fooo) c
+ using(fooo)) order by fooo \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_multiple2.cfg b/yql/essentials/tests/sql/suites/pg/join_using_multiple2.cfg
new file mode 100644
index 0000000000..8ea83a7905
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_multiple2.cfg
@@ -0,0 +1,3 @@
+in Input input_1.txt
+in Input2 input_2.txt
+in Input3 input_3.txt \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_multiple2.sql b/yql/essentials/tests/sql/suites/pg/join_using_multiple2.sql
new file mode 100644
index 0000000000..56fbd4ce06
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_multiple2.sql
@@ -0,0 +1,9 @@
+--!syntax_pg
+select * from (
+ (plato."Input"
+ join
+ plato."Input2"
+ using (id))
+ join
+ plato."Input3"
+ using (id)) order by id \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_multiple3.sql b/yql/essentials/tests/sql/suites/pg/join_using_multiple3.sql
new file mode 100644
index 0000000000..989b9822bb
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_multiple3.sql
@@ -0,0 +1,12 @@
+--!syntax_pg
+select foo, q.foo as a1, w.foo as a2, e.foo as a3, r.foo as a4 from
+ ((select 1 as foo) q
+ full join
+ (select 2 as foo) w
+ using (foo))
+ full join
+ ((select 3 as foo) e
+ full join
+ (select 4 as foo) r
+ using (foo))
+ using(foo) order by foo \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_table_used_order.sql b/yql/essentials/tests/sql/suites/pg/join_using_table_used_order.sql
new file mode 100644
index 0000000000..a3f58c4dbd
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_table_used_order.sql
@@ -0,0 +1,13 @@
+--!syntax_pg
+select * from
+ ((select 1 as foo) aa
+ join
+ (select 1 as foo, 2 as bar) bb
+ using (foo)
+ join
+ (select 2 as bar, 1 as x) cc
+ using (bar)
+ join
+ (select 1 as x) dd
+ using (x)
+ ) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_table_used_order1.sql b/yql/essentials/tests/sql/suites/pg/join_using_table_used_order1.sql
new file mode 100644
index 0000000000..bd66d6881f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_table_used_order1.sql
@@ -0,0 +1,10 @@
+--!syntax_pg
+select * from
+ ((select 1 as foo, 1 as x) aa
+ join
+ (select 1 as foo, 2 as bar) bb
+ using (foo)
+ join
+ (select 2 as zoo, 1 as x) cc
+ using (x)
+ ) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_table_used_order2.cfg b/yql/essentials/tests/sql/suites/pg/join_using_table_used_order2.cfg
new file mode 100644
index 0000000000..eb2e5315d1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_table_used_order2.cfg
@@ -0,0 +1 @@
+xfail \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_table_used_order2.sql b/yql/essentials/tests/sql/suites/pg/join_using_table_used_order2.sql
new file mode 100644
index 0000000000..b5d0bdd25c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_table_used_order2.sql
@@ -0,0 +1,10 @@
+--!syntax_pg
+select * from
+ ((select 1 as foo, 1 as bar, 1 as zoo) aa
+ join
+ (select 1 as foo, 1 as bar, 1 as zoo) bb
+ using (foo)
+ join
+ (select 1 as bar, 1 as zoo) cc
+ using (zoo)
+ ) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_tables1.sql b/yql/essentials/tests/sql/suites/pg/join_using_tables1.sql
new file mode 100644
index 0000000000..6641655afc
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_tables1.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select a.* from (
+ plato."Input" a
+ join
+ plato."Input"
+ using(key)) order by key \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_tables2.sql b/yql/essentials/tests/sql/suites/pg/join_using_tables2.sql
new file mode 100644
index 0000000000..e8a7531146
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_tables2.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select a.* from (
+ plato."Input"
+ join
+ plato."Input" a
+ using(key)) order by key \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_tables3.sql b/yql/essentials/tests/sql/suites/pg/join_using_tables3.sql
new file mode 100644
index 0000000000..4d7ccc7630
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_tables3.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select * from (
+ plato."Input" a
+ full join
+ plato."Input"
+ using(key,subkey,value)) order by key \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/join_using_tables4.sql b/yql/essentials/tests/sql/suites/pg/join_using_tables4.sql
new file mode 100644
index 0000000000..008fcbf819
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/join_using_tables4.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select key from (
+ plato."Input" a
+ full join
+ plato."Input5"
+ using(key)) order by key \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/lang_sql.sql b/yql/essentials/tests/sql/suites/pg/lang_sql.sql
new file mode 100644
index 0000000000..e402811d94
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/lang_sql.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select lpad('abc',5);
+
diff --git a/yql/essentials/tests/sql/suites/pg/long_ident.sql b/yql/essentials/tests/sql/suites/pg/long_ident.sql
new file mode 100644
index 0000000000..817162befa
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/long_ident.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 as aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggg \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/multi_usage_cross_join.sql b/yql/essentials/tests/sql/suites/pg/multi_usage_cross_join.sql
new file mode 100644
index 0000000000..f62e70eb34
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/multi_usage_cross_join.sql
@@ -0,0 +1,13 @@
+--!syntax_pg
+
+with foo(x) as (
+ select 1 as x
+)
+select count(*) from foo a,foo b
+where a.x=b.x and a.x<2;
+
+with foo(x) as (
+ select 1 as x
+)
+select count(*) from foo a,foo b
+where a.x=b.x and a.x>1;
diff --git a/yql/essentials/tests/sql/suites/pg/name.cfg b/yql/essentials/tests/sql/suites/pg/name.cfg
new file mode 100644
index 0000000000..d54cfe5b7e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/name.cfg
@@ -0,0 +1,2 @@
+in Input input_name.txt
+out Output output.txt \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/name.sql b/yql/essentials/tests/sql/suites/pg/name.sql
new file mode 100644
index 0000000000..42d2e28596
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/name.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+INSERT INTO plato."Output"
+SELECT
+ key, index+1 as index
+FROM plato."Input"
+ORDER BY index; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/nothing.sql b/yql/essentials/tests/sql/suites/pg/nothing.sql
new file mode 100644
index 0000000000..a55d35ec52
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/nothing.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select null::bool,null::int,null::float,null::varchar
diff --git a/yql/essentials/tests/sql/suites/pg/nullif.sql b/yql/essentials/tests/sql/suites/pg/nullif.sql
new file mode 100644
index 0000000000..8207ab1c99
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/nullif.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select nullif(1, 1), nullif(1, 2.2), nullif(2, 1), nullif(1.2, '7'), nullif(1.2, '1.2'); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/nulls.sql b/yql/essentials/tests/sql/suites/pg/nulls.sql
new file mode 100644
index 0000000000..3ba4143226
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/nulls.sql
@@ -0,0 +1,39 @@
+use plato;
+
+insert into @foo
+select
+
+ 1 as a,
+ Nothing(pgcstring) as i1,
+
+ Just(Nothing(pgcstring)) as j1,
+ Nothing(pgcstring?) as j2,
+
+ Just(Just(Nothing(pgcstring))) as k1,
+ Just(Nothing(pgcstring?)) as k2,
+ Nothing(pgcstring??) as k3
+
+;
+
+commit;
+
+insert into @bar
+select t.a+1 as a,t.* without a from @foo as t;
+
+commit;
+
+select
+a,
+i1,i1 is null as i1n,
+j1,j1 is null as j1n,
+j2,j2 is null as j2n,
+k1,k1 is null as k1n,
+k2,k2 is null as k2n,
+k3,k3 is null as k3n
+from @bar;
+
+
+
+
+
+
diff --git a/yql/essentials/tests/sql/suites/pg/nulls_native.sql b/yql/essentials/tests/sql/suites/pg/nulls_native.sql
new file mode 100644
index 0000000000..3b77aeb9db
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/nulls_native.sql
@@ -0,0 +1,40 @@
+use plato;
+pragma yt.UseNativeYtTypes;
+
+insert into @foo
+select
+
+ 1 as a,
+ Nothing(pgcstring) as i1,
+
+ Just(Nothing(pgcstring)) as j1,
+ Nothing(pgcstring?) as j2,
+
+ Just(Just(Nothing(pgcstring))) as k1,
+ Just(Nothing(pgcstring?)) as k2,
+ Nothing(pgcstring??) as k3
+
+;
+
+commit;
+
+insert into @bar
+select t.a+1 as a,t.* without a from @foo as t;
+
+commit;
+
+select
+a,
+i1,i1 is null as i1n,
+j1,j1 is null as j1n,
+j2,j2 is null as j2n,
+k1,k1 is null as k1n,
+k2,k2 is null as k2n,
+k3,k3 is null as k3n
+from @bar;
+
+
+
+
+
+
diff --git a/yql/essentials/tests/sql/suites/pg/numbers_to_pg.sql b/yql/essentials/tests/sql/suites/pg/numbers_to_pg.sql
new file mode 100644
index 0000000000..d8888ac9a0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/numbers_to_pg.sql
@@ -0,0 +1,5 @@
+select ToPg(-128t),ToPg(127t),ToPg(0ut),ToPg(255ut),
+ ToPg(-32768s),ToPg(32767s),ToPg(0us),ToPg(65535us),
+ ToPg(-2147483648),ToPg(2147483647),ToPg(0u),ToPg(4294967295u),
+ ToPg(-9223372036854775808l),ToPg(9223372036854775807l),ToPg(0ul),ToPg(9223372036854775807ul),ToPg(9223372036854775808ul),ToPg(18446744073709551615ul),
+ ToPg(1.3f),ToPg(-2.4);
diff --git a/yql/essentials/tests/sql/suites/pg/numeric_to_pg.sql b/yql/essentials/tests/sql/suites/pg/numeric_to_pg.sql
new file mode 100644
index 0000000000..5972bd219a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/numeric_to_pg.sql
@@ -0,0 +1,3 @@
+select ToPg(Decimal('nan',25,1)), ToPg(Decimal('inf',25,1)), ToPg(Decimal('-inf',25,1)),
+ ToPg(Decimal('1.23',25,1)), ToPg(DyNumber("-10.23"));
+
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_agg_extra_for_keys.sql b/yql/essentials/tests/sql/suites/pg/order_by_agg_extra_for_keys.sql
new file mode 100644
index 0000000000..070e5d7064
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_agg_extra_for_keys.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select x
+from (values (1,2,3)) a(x,y,z)
+group by x,y
+order by y,count(z) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_aggr.sql b/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_aggr.sql
new file mode 100644
index 0000000000..87253bf1b2
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_aggr.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select 1
+from (values (1,1),(2,5),(2,4)) a(x,y)
+group by x
+order by count(*)
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_full.sql b/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_full.sql
new file mode 100644
index 0000000000..6498f10b3c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_full.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select sum(x)
+from (values (1,1),(2,5),(2,4)) a(x,y)
+order by count(*)
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_keys.sql b/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_keys.sql
new file mode 100644
index 0000000000..815173ba29
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_keys.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select 1
+from (values (1,1),(2,5),(2,4)) a(x,y)
+group by x
+order by x
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_prj_and_aggr.sql b/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_prj_and_aggr.sql
new file mode 100644
index 0000000000..73e2f8efcf
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_prj_and_aggr.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select x, count(*)
+from (values (1,1),(3,5),(3,4)) a(x,y)
+group by x
+order by count(*)+1 desc
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_prj_and_keys_and_aggr.sql b/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_prj_and_keys_and_aggr.sql
new file mode 100644
index 0000000000..076e8ea186
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_agg_input_columns_prj_and_keys_and_aggr.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select x, count(*)
+from (values (1,1),(3,5),(3,4)) a(x,y)
+group by x
+order by count(*)+1 desc,x
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_agg_no_extra_for_aggs.sql b/yql/essentials/tests/sql/suites/pg/order_by_agg_no_extra_for_aggs.sql
new file mode 100644
index 0000000000..5c6cf52019
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_agg_no_extra_for_aggs.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select count(x) as y
+from (values (1)) a(x)
+order by sum(x)
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr.sql b/yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr.sql
new file mode 100644
index 0000000000..56a03ea834
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select distinct x+1 as y,x-1 from (select 1 as x) a order by x+1,x-1
+
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr_agg.sql b/yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr_agg.sql
new file mode 100644
index 0000000000..2ea98f75e5
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr_agg.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select distinct (x + 1) * 2 as y,(x + 1) * 3,min(z) - 1 from (select 1 as x,2 as z) a group by x + 1 order by (x + 1) * 2, (x + 1) * 3, min(z) - 1
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr_agg_sublink.sql b/yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr_agg_sublink.sql
new file mode 100644
index 0000000000..3f1d1169d3
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_distinct_same_expr_agg_sublink.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select distinct x + 1/(select count(*) from pg_type) as y from (select 1 as x) a order by x + 1/(select count(*) from pg_type)
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_input_columns.sql b/yql/essentials/tests/sql/suites/pg/order_by_input_columns.sql
new file mode 100644
index 0000000000..c1735bcfff
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_input_columns.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select y
+from (values (1,1),(2,5),(7,4)) a(x,y)
+order by x desc \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_input_columns_qual.sql b/yql/essentials/tests/sql/suites/pg/order_by_input_columns_qual.sql
new file mode 100644
index 0000000000..536d1ce2eb
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_input_columns_qual.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select y
+from (values (1,1),(2,5),(7,4)) a(x,y)
+order by a.x desc \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_shadow_input_columns.sql b/yql/essentials/tests/sql/suites/pg/order_by_shadow_input_columns.sql
new file mode 100644
index 0000000000..16de18abe3
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_shadow_input_columns.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select -x as x
+from (values (1,1),(2,5),(7,4)) a(x,y)
+order by x desc \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/order_by_shadow_input_columns_qual.sql b/yql/essentials/tests/sql/suites/pg/order_by_shadow_input_columns_qual.sql
new file mode 100644
index 0000000000..d04a344882
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/order_by_shadow_input_columns_qual.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select -x as x
+from (values (1,1),(2,5),(7,4)) a(x,y)
+order by a.x desc \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/palloc_big_string.sql b/yql/essentials/tests/sql/suites/pg/palloc_big_string.sql
new file mode 100644
index 0000000000..059b2a322b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/palloc_big_string.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+-- string larger than page (65489 bytes)
+select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
diff --git a/yql/essentials/tests/sql/suites/pg/param_text1.json b/yql/essentials/tests/sql/suites/pg/param_text1.json
new file mode 100644
index 0000000000..d4e83b6c9e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/param_text1.json
@@ -0,0 +1 @@
+"param_text1"
diff --git a/yql/essentials/tests/sql/suites/pg/param_text2.json b/yql/essentials/tests/sql/suites/pg/param_text2.json
new file mode 100644
index 0000000000..b948e9f727
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/param_text2.json
@@ -0,0 +1 @@
+"param_text2"
diff --git a/yql/essentials/tests/sql/suites/pg/parametrized.cfg b/yql/essentials/tests/sql/suites/pg/parametrized.cfg
new file mode 100644
index 0000000000..094e634048
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/parametrized.cfg
@@ -0,0 +1,2 @@
+param $p1 param_text1.json
+param $p2 param_text2.json
diff --git a/yql/essentials/tests/sql/suites/pg/parametrized.sql b/yql/essentials/tests/sql/suites/pg/parametrized.sql
new file mode 100644
index 0000000000..96304e7cc0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/parametrized.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select $1 as "text_col", $2 as "text_col_2";
diff --git a/yql/essentials/tests/sql/suites/pg/pg_array_cast.sql b/yql/essentials/tests/sql/suites/pg/pg_array_cast.sql
new file mode 100644
index 0000000000..7cbe0cc881
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_array_cast.sql
@@ -0,0 +1,9 @@
+--!syntax_pg
+select
+cast(array[1,2,3] as text),
+cast('{1,2,3}' as _int4),
+cast(array[1,2,3] as _int8),
+cast(array[1,2,3] as _text),
+cast(array['1',null,'3'] as _int4),
+cast(array['{"a":1}'::json,'{"b":2}'::json] as _jsonb),
+cast(array[1,2,3] as _oid)
diff --git a/yql/essentials/tests/sql/suites/pg/pg_array_compare.sql b/yql/essentials/tests/sql/suites/pg/pg_array_compare.sql
new file mode 100644
index 0000000000..aa890a286e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_array_compare.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select array[1, 2] < array[1, 3]
+ , array[1, 2] = array[1, 3]
+;
+
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_array_literal.sql b/yql/essentials/tests/sql/suites/pg/pg_array_literal.sql
new file mode 100644
index 0000000000..ff3435ec7a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_array_literal.sql
@@ -0,0 +1,15 @@
+--!syntax_pg
+select
+array['a','b'] a1,
+array[array['a','b']] a2,
+array[array['a','b'],array['c','d']] a3,
+array['a',null] a4,
+array[null] a5,
+array[1] a6,
+array[1,2] a7,
+array[null::int4,2] a8,
+array[array[1,2]] a9,
+array[array[1,2],array[3,4]] a10,
+array_out(array[1,2]) a11,
+array_out(array[null,'NULL','',',','{}']) a12
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_column_case.cfg b/yql/essentials/tests/sql/suites/pg/pg_column_case.cfg
new file mode 100644
index 0000000000..a175d357b1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_column_case.cfg
@@ -0,0 +1,2 @@
+in InputC inputC.txt
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_column_case.sql b/yql/essentials/tests/sql/suites/pg/pg_column_case.sql
new file mode 100644
index 0000000000..a04df0091f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_column_case.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+select id, CodeGen_FullTime
+ , "CodeGen_FullTime" as Quoted
+ , CodeGen_FullTime || 'x'
+ , "CodeGen_FullTime" || 'x'
+ , (CodeGen_FullTime || 'x')
+from plato."InputC" limit 100;
diff --git a/yql/essentials/tests/sql/suites/pg/pg_corr_count.sql b/yql/essentials/tests/sql/suites/pg/pg_corr_count.sql
new file mode 100644
index 0000000000..150d502aea
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_corr_count.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+SELECT y,
+(select count(*) from (values (1),(2),(3)) a(x) where a.x=y
+)
+FROM
+(values (4)) b(y)
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_corr_limit.sql b/yql/essentials/tests/sql/suites/pg/pg_corr_limit.sql
new file mode 100644
index 0000000000..aab8a41c46
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_corr_limit.sql
@@ -0,0 +1,10 @@
+--!syntax_pg
+SELECT y,
+(
+ select x+y as v from (values (1),(1),(1)) a(x)
+ limit 1
+)
+FROM
+(values (40),(50),(60)) b(y)
+order by y
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_corr_offset.sql b/yql/essentials/tests/sql/suites/pg/pg_corr_offset.sql
new file mode 100644
index 0000000000..0b86d1ae7e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_corr_offset.sql
@@ -0,0 +1,10 @@
+--!syntax_pg
+SELECT y,
+(
+ select x+y as v from (values (1),(1),(1)) a(x)
+ offset 2
+)
+FROM
+(values (40),(50),(60)) b(y)
+order by y
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_corr_sort_limit.sql b/yql/essentials/tests/sql/suites/pg/pg_corr_sort_limit.sql
new file mode 100644
index 0000000000..81c4edba78
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_corr_sort_limit.sql
@@ -0,0 +1,11 @@
+--!syntax_pg
+SELECT y,
+(
+ select x+y as v from (values (3),(1),(2)) a(x)
+ order by v
+ limit 1
+)
+FROM
+(values (40),(50),(60)) b(y)
+order by y
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_corr_sort_limit2.sql b/yql/essentials/tests/sql/suites/pg/pg_corr_sort_limit2.sql
new file mode 100644
index 0000000000..1707b33558
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_corr_sort_limit2.sql
@@ -0,0 +1,13 @@
+--!syntax_pg
+SELECT y,
+(
+ select x+y as v from (values (3),(1)) a(x)
+ union all
+ select x+y as v from (values (2)) a(x)
+ order by v
+ limit 1
+)
+FROM
+(values (40),(50),(60)) b(y)
+order by y
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_in_dict_key_with_stable_pickle.sql b/yql/essentials/tests/sql/suites/pg/pg_in_dict_key_with_stable_pickle.sql
new file mode 100644
index 0000000000..95495e7616
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_in_dict_key_with_stable_pickle.sql
@@ -0,0 +1,8 @@
+select StablePickle({{1,2},{3,4}}) == StablePickle({{4,3},{2,1}});
+
+select
+ StablePickle({{pgdate('2020-01-01'),pgdate('2020-01-02')},{pgdate('2020-01-03'),pgdate('2020-01-04')}}) ==
+ StablePickle({{pgdate('2020-01-04'),pgdate('2020-01-03')},{pgdate('2020-01-02'),pgdate('2020-01-01')}});
+
+select StablePickle({{pgbit('0001'),pgbit('0010')},{pgbit('0100'),pgbit('1000')}}) ==
+ StablePickle({{pgbit('1000'),pgbit('0100')},{pgbit('0010'),pgbit('0001')}}); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/pg_in_expr.sql b/yql/essentials/tests/sql/suites/pg/pg_in_expr.sql
new file mode 100644
index 0000000000..913e76fabf
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_in_expr.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 in (2),1 in (2,1), 1 in (1),null::int4 in (1),1 in (null::int4),null in (null) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/pg_interval_literal.sql b/yql/essentials/tests/sql/suites/pg/pg_interval_literal.sql
new file mode 100644
index 0000000000..43e50a75c0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_interval_literal.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select
+ INTERVAL '1 day 2:03:04' HOUR TO MINUTE,
+ INTERVAL '5',
+ INTERVAL '90' DAY
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_iterate.sql b/yql/essentials/tests/sql/suites/pg/pg_iterate.sql
new file mode 100644
index 0000000000..2c58f3957b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_iterate.sql
@@ -0,0 +1,22 @@
+pragma warning("disable","4510");
+$init = ListCreate(Struct<n:Int32>);
+$transform = ($value)->{
+ return ListMap(ListFilter($value, ($r)->($r.n<5)), ($r)->(<|n:$r.n + 1|>));
+};
+
+select * from AS_TABLE(Yql::PgIterateAll($init,$transform)) order by n;
+
+$init = [<|n:1|>];
+$transform = ($value)->{
+ return ListMap(ListFilter($value, ($r)->($r.n<5)), ($r)->(<|n:$r.n + 1|>));
+};
+
+select * from AS_TABLE(Yql::PgIterateAll($init,$transform)) order by n;
+
+$init = [<|n:1|>, <|n:1|>, <|n:2|>];
+$transform = ($value)->{
+ return ListFlatMap($value, ($_r)->([<|n:1|>,<|n:2|>,<|n:2|>]));
+};
+
+select * from AS_TABLE(Yql::PgIterate($init,$transform)) order by n;
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_like.cfg b/yql/essentials/tests/sql/suites/pg/pg_like.cfg
new file mode 100644
index 0000000000..e035127424
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_like.cfg
@@ -0,0 +1 @@
+udf re2_udf
diff --git a/yql/essentials/tests/sql/suites/pg/pg_like.sql b/yql/essentials/tests/sql/suites/pg/pg_like.sql
new file mode 100644
index 0000000000..3a21574890
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_like.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select x like y from ( select 'a' as x, 'a%' as y) as a;
+select x ilike y from ( select 'a' as x, 'A%' as y) as a;
+select x like y from ( select 'a' as x, 'A%' as y) as a;
+select x like y from ( select 'a' as x, null as y) as a;
+select x like y from ( select null as x, 'a%' as y) as a;
diff --git a/yql/essentials/tests/sql/suites/pg/pg_like_cast.sql b/yql/essentials/tests/sql/suites/pg/pg_like_cast.sql
new file mode 100644
index 0000000000..998a6c6514
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_like_cast.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+SELECT count(*) FROM pg_class WHERE relkind='i' AND relname LIKE 'guid%';
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_like_opt.sql b/yql/essentials/tests/sql/suites/pg/pg_like_opt.sql
new file mode 100644
index 0000000000..0c3c60d5c1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_like_opt.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 'abc' like 'abc', 'abc' like '%bc', 'abc' like 'ab%', 'abc' like '%b%' \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/pg_type_from_oid.sql b/yql/essentials/tests/sql/suites/pg/pg_type_from_oid.sql
new file mode 100644
index 0000000000..2fe7acb7be
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_type_from_oid.sql
@@ -0,0 +1,2 @@
+select FormatType(PgType(25)), FormatType(PgType("int4"));
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_aggregate1.sql b/yql/essentials/tests/sql/suites/pg/pg_types_aggregate1.sql
new file mode 100644
index 0000000000..a8eaecab0f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_aggregate1.sql
@@ -0,0 +1,80 @@
+--!syntax_pg
+select count(*) from (
+select 1 as x,2 as y
+union all
+select 2 as x,3 as y
+) a;
+
+select count(x) from (
+select 1 as x,2 as y
+union all
+select 2 as x,3 as y
+union all
+select 3 as x,3 as y
+) a;
+
+select count(x) from (
+select null::int4 as x,2 as y
+union all
+select 2 as x,3 as y
+union all
+select 3 as x,3 as y
+) a;
+
+select count(x) from (
+select 1 as x,2 as y
+union all
+select null::int4 as x,3 as y
+union all
+select 3 as x,3 as y
+) a;
+
+select count(x) from (
+select 1 as x,2 as y
+union all
+select 2 as x,3 as y
+union all
+select null::int4 as x,3 as y
+) a;
+
+select sum(x) from (
+select 10 as x,2 as y
+union all
+select 20 as x,3 as y
+) a;
+
+select sum(x) from (
+select 10 as x,2 as y
+union all
+select null::int4 as x,3 as y
+) a;
+
+select sum(x) from (
+select null::int4 as x,2 as y
+union all
+select 20 as x,3 as y
+) a;
+
+select sum(x) from (
+select 10.0::float8 as x,2 as y
+union all
+select 20.0::float8 as x,3 as y
+) a;
+
+select sum(x) from (
+select 10.0::float8 as x,2 as y
+union all
+select null::float8 as x,3 as y
+) a;
+
+select sum(x) from (
+select null::float8 as x,2 as y
+union all
+select 20.0::float8 as x,3 as y
+) a;
+
+select regr_count(x,y) from (
+select 1.0::float8 as x,2.0::float8 as y
+union all
+select 2.0::float8 as x,3.0::float8 as y
+) a;
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_array_literal.sql b/yql/essentials/tests/sql/suites/pg/pg_types_array_literal.sql
new file mode 100644
index 0000000000..12c49c1f02
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_array_literal.sql
@@ -0,0 +1 @@
+select PgArray(1p,null,2p)
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_cast_with_length.sql b/yql/essentials/tests/sql/suites/pg/pg_types_cast_with_length.sql
new file mode 100644
index 0000000000..fad800a55a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_cast_with_length.sql
@@ -0,0 +1,9 @@
+--!syntax_pg
+select
+ cast('foo' as varchar(2)),
+ cast(12345 as varchar(2)),
+ cast('{foo,bar}' as _varchar(2)),
+ cast(array['foo','bar'] as _varchar(2)),
+ cast(array[12345,67890] as _varchar(2)),
+ cast(array['foo','bar'] as varchar(2)),
+ cast(array[12345,67890] as varchar(2));
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_dict.cfg b/yql/essentials/tests/sql/suites/pg/pg_types_dict.cfg
new file mode 100644
index 0000000000..73b348a561
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_dict.cfg
@@ -0,0 +1,4 @@
+in Input input.txt
+in Input2 input2.txt
+providers yt
+
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_dict.sql b/yql/essentials/tests/sql/suites/pg/pg_types_dict.sql
new file mode 100644
index 0000000000..54634fff1e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_dict.sql
@@ -0,0 +1,17 @@
+select
+ToSortedDict([([pgdate('2012-01-01')],0), ([pgdate('2012-01-01')],1)]),
+ToDict([([pgdate('2012-01-01')],0), ([pgdate('2012-01-01')],1)]),
+ToSortedMultiDict([([pgdate('2012-01-01')],0), ([pgdate('2012-01-01')],1)]),
+ToMultiDict([([pgdate('2012-01-01')],0), ([pgdate('2012-01-01')],1)]);
+
+select
+ToSortedDict([([pgtext('2012-01-01')],0), ([pgtext('2012-01-01')],1)]),
+ToDict([([pgtext('2012-01-01')],0), ([pgtext('2012-01-01')],1)]),
+ToSortedMultiDict([([pgtext('2012-01-01')],0), ([pgtext('2012-01-01')],1)]),
+ToMultiDict([([pgtext('2012-01-01')],0), ([pgtext('2012-01-01')],1)]);
+
+select
+ToSortedDict([([pgdate('2021-01-01')],0), ([pgdate('1999-01-01')],1)]);
+
+select
+ToSortedDict([([pgtext('2021-01-01')],0), ([pgtext('1999-01-01')],1)]);
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_literal_mods.sql b/yql/essentials/tests/sql/suites/pg/pg_types_literal_mods.sql
new file mode 100644
index 0000000000..6765b0b504
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_literal_mods.sql
@@ -0,0 +1,14 @@
+select
+PgConst(90,pginterval,"day"),
+PgConst("1.2345678",pginterval,"second",3),
+PgConst('{90}',_pginterval,"day"),
+PgConst('13.45',pgnumeric,10,1),
+PgConst('{13.45}',_pgnumeric,10,1),
+PgCast('90'p,pginterval,"day"),
+PgCast('13.45'p,pgnumeric,10,1),
+PgCast('{90}'p,_pginterval,"day"),
+PgCast('{13.45}'p,_pgnumeric,10,1),
+PgInterval(90, "day"),
+PgNumeric(13.45, 10, 1),
+_PgInterval('{90}', "day"),
+_PgNumeric('{13.45}', 10, 1);
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_literal_with_length.sql b/yql/essentials/tests/sql/suites/pg/pg_types_literal_with_length.sql
new file mode 100644
index 0000000000..08ff3c1bda
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_literal_with_length.sql
@@ -0,0 +1,4 @@
+select
+ PgConst('foo', pgvarchar, 2),
+ PgConst(12345, pgvarchar, 2),
+ PgConst('{foo,bar}', _pgvarchar, 2);
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_orderby.cfg b/yql/essentials/tests/sql/suites/pg/pg_types_orderby.cfg
new file mode 100644
index 0000000000..748ba77b3f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_orderby.cfg
@@ -0,0 +1,2 @@
+in Input4 input4.txt
+providers dq
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_orderby.sql b/yql/essentials/tests/sql/suites/pg/pg_types_orderby.sql
new file mode 100644
index 0000000000..56fd84dded
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_orderby.sql
@@ -0,0 +1,32 @@
+--!syntax_pg
+select b_val::bool as value
+from plato."Input4"
+order by value;
+
+select i_val::int2 as value
+from plato."Input4"
+order by value;
+
+select i_val::int4 as value
+from plato."Input4"
+order by value;
+
+select i_val::int8 as value
+from plato."Input4"
+order by value;
+
+select i_val::float4 as value
+from plato."Input4"
+order by value;
+
+select i_val::float8 as value
+from plato."Input4"
+order by value;
+
+select d_val::bytea as value
+from plato."Input4"
+order by value;
+
+select d_val::date as value
+from plato."Input4"
+order by value;
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_window1.sql b/yql/essentials/tests/sql/suites/pg/pg_types_window1.sql
new file mode 100644
index 0000000000..988682a9c7
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_window1.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select string_agg(x,',') over w
+from (values ('a'),('b'),('c')) a(x)
+window w as (order by x)
diff --git a/yql/essentials/tests/sql/suites/pg/pg_types_window2.sql b/yql/essentials/tests/sql/suites/pg/pg_types_window2.sql
new file mode 100644
index 0000000000..a08d28ad30
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_types_window2.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select x,row_number() over w,lag(x) over w,lead(x) over w
+from (values ('a'),('b'),('c')) a(x)
+window w as (order by x)
diff --git a/yql/essentials/tests/sql/suites/pg/pg_view.sql b/yql/essentials/tests/sql/suites/pg/pg_view.sql
new file mode 100644
index 0000000000..f62fe320b3
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pg_view.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+create view a(x,y) as select 1,2;
+select * from a;
+create or replace view a(x,y) as values (3,4);
+select * from a;
+drop view a;
+drop view if exists a,b,c;
diff --git a/yql/essentials/tests/sql/suites/pg/pgns_agg.sql b/yql/essentials/tests/sql/suites/pg/pgns_agg.sql
new file mode 100644
index 0000000000..bb19c6421e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pgns_agg.sql
@@ -0,0 +1,2 @@
+select PgAgg::count() from (select 1);
+
diff --git a/yql/essentials/tests/sql/suites/pg/pgns_proc.sql b/yql/essentials/tests/sql/suites/pg/pgns_proc.sql
new file mode 100644
index 0000000000..3429538606
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/pgns_proc.sql
@@ -0,0 +1 @@
+select PgProc::upper('a'u);
diff --git a/yql/essentials/tests/sql/suites/pg/point.sql b/yql/essentials/tests/sql/suites/pg/point.sql
new file mode 100644
index 0000000000..c106a3ecca
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/point.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select key,'(1,2)'::point from plato."Input"
+order by key;
diff --git a/yql/essentials/tests/sql/suites/pg/range_function_multi.sql b/yql/essentials/tests/sql/suites/pg/range_function_multi.sql
new file mode 100644
index 0000000000..4f188c9000
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/range_function_multi.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select * from generate_series(1,10);
+select * from generate_series(1,10) x;
+select * from generate_series(1,10) x(y);
diff --git a/yql/essentials/tests/sql/suites/pg/range_function_multi_record.sql b/yql/essentials/tests/sql/suites/pg/range_function_multi_record.sql
new file mode 100644
index 0000000000..da9330fc6a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/range_function_multi_record.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select * from json_each('{"a":"foo", "b":"bar"}');
+select * from json_each('{"a":"foo", "b":"bar"}') as f;
+select * from json_each('{"a":"foo", "b":"bar"}') as f(x,y);
diff --git a/yql/essentials/tests/sql/suites/pg/range_function_scalar.sql b/yql/essentials/tests/sql/suites/pg/range_function_scalar.sql
new file mode 100644
index 0000000000..e5b0525ddd
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/range_function_scalar.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select * from upper('abc');
+select * from upper('abc') x;
+select * from upper('abc') x(a);
diff --git a/yql/essentials/tests/sql/suites/pg/record_from_table_row.sql b/yql/essentials/tests/sql/suites/pg/record_from_table_row.sql
new file mode 100644
index 0000000000..5133380ec6
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/record_from_table_row.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+SELECT row_to_json(TR)
+FROM (select 'foo' as y, 1 as x) tr
+
diff --git a/yql/essentials/tests/sql/suites/pg/reflection.sql b/yql/essentials/tests/sql/suites/pg/reflection.sql
new file mode 100644
index 0000000000..b36947e5d0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/reflection.sql
@@ -0,0 +1,2 @@
+select FormatType(PgTypeHandle("text")),PgTypeName(TypeHandle(_pgint4));
+
diff --git a/yql/essentials/tests/sql/suites/pg/regoids.sql b/yql/essentials/tests/sql/suites/pg/regoids.sql
new file mode 100644
index 0000000000..c0b14dfdd5
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/regoids.sql
@@ -0,0 +1,44 @@
+--!syntax_pg
+
+-- Tests for OID types
+-- See https://www.postgresql.org/docs/14/datatype-oid.html
+
+select oid, oid::regclass from pg_catalog.pg_class
+where oid::regclass in ('pg_user', 'pg_group');
+
+select oid, oid::regconfig from pg_catalog.pg_ts_config
+where oid::regconfig in ('english', 'russian');
+
+select oid, oid::regdictionary from pg_catalog.pg_ts_dict
+where oid::regdictionary in ('irish_stem', 'italian_stem');
+
+select oid, oid::regnamespace from pg_catalog.pg_namespace
+where oid::regnamespace in ('public', 'information_schema');
+
+/*
+TODO: uncomment after YQL-18711
+select oid, oid::regoperator from pg_catalog.pg_operator
+where oid::regoperator in ('=(integer,integer)', '+(float4,float8)');
+*/
+
+/*
+TODO: uncomment after YQL-18712
+select oid, oid::regproc from pg_catalog.pg_proc
+where oid::regproc in ('int4in', 'int4out');
+*/
+
+/*
+TODO: uncomment after YQL-18711
+select oid, oid::regprocedure from pg_catalog.pg_proc
+where oid::regprocedure in ('namein(cstring)', 'nameout(name)');
+*/
+
+select oid, oid::regrole from pg_catalog.pg_authid
+where oid::regrole in ('pg_read_all_data', 'pg_write_all_data');
+
+/*
+TODO: uncomment after YQL-18713
+select oid, oid::regtype from pg_catalog.pg_type
+where oid::regtype in ('boolean', 'char');
+*/
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg.sql b/yql/essentials/tests/sql/suites/pg/select_agg.sql
new file mode 100644
index 0000000000..6bb81d33fe
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select count(*) c1,count(x) c2,min(x) i1,max(x) a1,sum(x) s1 from
+(values (1),(3),(null::int4)) as u(x)
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_expr_having.sql b/yql/essentials/tests/sql/suites/pg/select_agg_expr_having.sql
new file mode 100644
index 0000000000..93437dce70
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_expr_having.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select 1
+from (values (1),(1)) a(x)
+group by x+1
+having x+1=2
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_expr_key_under_agg.sql b/yql/essentials/tests/sql/suites/pg/select_agg_expr_key_under_agg.sql
new file mode 100644
index 0000000000..026cd99a78
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_expr_key_under_agg.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select x, min(x) from (select 1 as x) a group by x \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_expr_order.sql b/yql/essentials/tests/sql/suites/pg/select_agg_expr_order.sql
new file mode 100644
index 0000000000..9e78d6ffdd
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_expr_order.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select 1
+from (values (1),(1)) a(x)
+group by x+1
+order by x+1
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_expr_projection.sql b/yql/essentials/tests/sql/suites/pg/select_agg_expr_projection.sql
new file mode 100644
index 0000000000..4e000dc3ce
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_expr_projection.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select x+1
+from (values (1),(1)) a(x)
+group by x+1
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_group.sql b/yql/essentials/tests/sql/suites/pg/select_agg_group.sql
new file mode 100644
index 0000000000..10caa8edb6
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_group.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select x,count(y),min(y),max(y),sum(y)
+from (values (1,2),(3,4),(3,5)) u(x,y)
+group by x
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_group_key_only.sql b/yql/essentials/tests/sql/suites/pg/select_agg_group_key_only.sql
new file mode 100644
index 0000000000..8a133d4248
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_group_key_only.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select x
+from (values (1,2),(3,4),(3,5)) u(x,y)
+group by x
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_gs_cube.sql b/yql/essentials/tests/sql/suites/pg/select_agg_gs_cube.sql
new file mode 100644
index 0000000000..e308294353
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_gs_cube.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+select x,y
+from (
+ values (1,2),(1,2),(2,3),(2,2)
+) a(x,y)
+group by cube(x,y)
+order by x,y \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_gs_grouping.sql b/yql/essentials/tests/sql/suites/pg/select_agg_gs_grouping.sql
new file mode 100644
index 0000000000..96f8a67ac9
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_gs_grouping.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+select x,y,grouping(x),grouping(y),grouping(x,y)
+from (
+ values (1,2),(1,2),(2,3),(2,2)
+) a(x,y)
+group by cube(x,y)
+order by x,y \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_gs_rollup.sql b/yql/essentials/tests/sql/suites/pg/select_agg_gs_rollup.sql
new file mode 100644
index 0000000000..2c556ad1f7
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_gs_rollup.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+select x,y
+from (
+ values (1,2),(1,2),(2,3),(2,2)
+) a(x,y)
+group by rollup(x,y)
+order by x,y \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_gs_sets.sql b/yql/essentials/tests/sql/suites/pg/select_agg_gs_sets.sql
new file mode 100644
index 0000000000..e702a254be
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_gs_sets.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+select x,y
+from (
+ values (1,2),(1,2),(2,3),(2,2)
+) a(x,y)
+group by grouping sets((x),(),(y))
+order by x,y \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_one_row.sql b/yql/essentials/tests/sql/suites/pg/select_agg_one_row.sql
new file mode 100644
index 0000000000..88f7f3e4c0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_one_row.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select
+ count(*) c1,count(0) c2,count(null) c3,count(null::text) c4,
+ min(5) i1,min('a') i2,min(1.0) i3,min(null) i4,min(null::text) i5,
+ max(6) a1,max('a') a2,max(1.0) a3,max(null) a4,max(null::text) a5,
+ sum(7) s1,sum(1.0) s2,sum(null::int) s3
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_qstar.sql b/yql/essentials/tests/sql/suites/pg/select_agg_qstar.sql
new file mode 100644
index 0000000000..f3e0c473df
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_qstar.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select 1,a.* from
+(values (1,2,3)) a(x,y,z)
+group by x,y,z \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_agg_star.sql b/yql/essentials/tests/sql/suites/pg/select_agg_star.sql
new file mode 100644
index 0000000000..28692ef83d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_agg_star.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select * from
+(values (1,2,3)) a(x,y,z)
+group by x,y,z \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_alias_partial.sql b/yql/essentials/tests/sql/suites/pg/select_alias_partial.sql
new file mode 100644
index 0000000000..2db4a8111e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_alias_partial.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select key,a.value,key2 from plato."Input" as a,plato."Input2";
diff --git a/yql/essentials/tests/sql/suites/pg/select_and_or_group.sql b/yql/essentials/tests/sql/suites/pg/select_and_or_group.sql
new file mode 100644
index 0000000000..ae0230e807
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_and_or_group.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 < 2 and 2 < 3 and 3 < 4 as and3_true, 1 < 2 and 2 > 3 and 3 < 4 as and3_false, 1 > 2 or 2 > 3 or 3 < 4 as or3_true, 1 > 2 or 2 > 3 or 3 > 4 as or3_false
diff --git a/yql/essentials/tests/sql/suites/pg/select_between.sql b/yql/essentials/tests/sql/suites/pg/select_between.sql
new file mode 100644
index 0000000000..17c57a604b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_between.sql
@@ -0,0 +1,11 @@
+--!syntax_pg
+select
+1 between 2 and 4,3 between 2 and 4,5 between 2 and 4,3 between 4 and 2,
+null::int4 between 2 and 4,1 between null::int4 and 4,1 between 4 and null::int4,1 between 0 and null::int4,
+null between null and null;
+
+select 3 between symmetric 4 and 2,
+3 between symmetric 0 and 2,
+null::int4 between symmetric 4 and 2,
+3 between symmetric null::int4 and 2,
+3 between symmetric 2 and null::int4;
diff --git a/yql/essentials/tests/sql/suites/pg/select_case.sql b/yql/essentials/tests/sql/suites/pg/select_case.sql
new file mode 100644
index 0000000000..67ba959fa8
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_case.sql
@@ -0,0 +1,20 @@
+--!syntax_pg
+
+select
+-- case $x when
+case 2 when 1 then 777 else 999 end a1,
+case 1 when 1 then 777 else 999 end a2,
+case 1 when 1 then 3 end a3,
+case 1 when 2 then 3 end a4,
+case 1 when 2 then 3 else 4 end a5,
+case 1 when 2 then 20 when 3 then 30 when 4 then 40 when 5 then 50 when 6 then 60 when 7 then 70 else 100 end a6,
+case 1 when 2 then 20 when 3 then 30 when 4 then 40 when 5 then 50 when 6 then 60 when 7 then 70 end a7,
+
+-- case when
+case when 2=1 then 777 else 999 end b1,
+case when 1=1 then 777 else 999 end b2,
+case when 1=1 then 3 end b3,
+case when 1=2 then 3 end b4,
+case when 1=2 then 3 else 4 end b5,
+case when 1=2 then 20 when 1=3 then 30 when 1=4 then 40 when 1=5 then 50 when 1=6 then 60 when 1=7 then 70 else 100 end b6,
+case when 1=2 then 20 when 1=3 then 30 when 1=4 then 40 when 1=5 then 50 when 1=6 then 60 when 1=7 then 70 end b7
diff --git a/yql/essentials/tests/sql/suites/pg/select_cast_same_arg.sql b/yql/essentials/tests/sql/suites/pg/select_cast_same_arg.sql
new file mode 100755
index 0000000000..d61a801716
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_cast_same_arg.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1::varchar(255) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_columnref1.sql b/yql/essentials/tests/sql/suites/pg/select_columnref1.sql
new file mode 100644
index 0000000000..b45b8e3cc3
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_columnref1.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select key, value || '!', key || value as c from plato."Input";
diff --git a/yql/essentials/tests/sql/suites/pg/select_columnref2.sql b/yql/essentials/tests/sql/suites/pg/select_columnref2.sql
new file mode 100644
index 0000000000..dce20796a8
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_columnref2.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select key, value || '!', key2, value2, key || value2 as c from plato."Input", plato."Input2";
diff --git a/yql/essentials/tests/sql/suites/pg/select_common_type_except.sql b/yql/essentials/tests/sql/suites/pg/select_common_type_except.sql
new file mode 100644
index 0000000000..8a08cf3234
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_common_type_except.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select 1
+except
+select '1';
diff --git a/yql/essentials/tests/sql/suites/pg/select_common_type_exceptall.sql b/yql/essentials/tests/sql/suites/pg/select_common_type_exceptall.sql
new file mode 100644
index 0000000000..f46620b7a7
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_common_type_exceptall.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+values ('1'), (1), ('2')
+except all
+select 1
+order by 1;
diff --git a/yql/essentials/tests/sql/suites/pg/select_common_type_if.sql b/yql/essentials/tests/sql/suites/pg/select_common_type_if.sql
new file mode 100644
index 0000000000..b92287e963
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_common_type_if.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select case when true then 1::numeric else -1::int4 end;
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_common_type_intersect.sql b/yql/essentials/tests/sql/suites/pg/select_common_type_intersect.sql
new file mode 100644
index 0000000000..f25b41e8c1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_common_type_intersect.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select '1'
+intersect
+select 1;
+
+select * from (values ('1'), ('2')) t
+intersect
+select '1';
diff --git a/yql/essentials/tests/sql/suites/pg/select_common_type_intersectall.sql b/yql/essentials/tests/sql/suites/pg/select_common_type_intersectall.sql
new file mode 100644
index 0000000000..11bd725c66
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_common_type_intersectall.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+values ('1'), (1), (2)
+intersect all
+select 1;
diff --git a/yql/essentials/tests/sql/suites/pg/select_common_type_union.sql b/yql/essentials/tests/sql/suites/pg/select_common_type_union.sql
new file mode 100644
index 0000000000..5858c2f9c4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_common_type_union.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+select 1
+union
+select '1'
+union
+select '2'
+order by 1;
diff --git a/yql/essentials/tests/sql/suites/pg/select_common_type_unionall.cfg b/yql/essentials/tests/sql/suites/pg/select_common_type_unionall.cfg
new file mode 100644
index 0000000000..1a343da34c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_common_type_unionall.cfg
@@ -0,0 +1 @@
+in Input input_pg_int_and_text.txt
diff --git a/yql/essentials/tests/sql/suites/pg/select_common_type_unionall.sql b/yql/essentials/tests/sql/suites/pg/select_common_type_unionall.sql
new file mode 100644
index 0000000000..9b9c379e87
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_common_type_unionall.sql
@@ -0,0 +1,21 @@
+--!syntax_pg
+
+-- check unknown-typed string literals converted to int and text types
+-- also check that column names from the 1st select are used for result columns
+select 1 as step, '1', 'x' as c2
+union all
+-- 2nd column is of integer type
+-- It's important to have one of 1st columns' value as the 2nd column value in this SELECT. That helps us to catch ExprNode sharing bugs
+select 2, 3, null as c3
+union all
+-- we need to check casts of aggregation functions' results, so make 2nd column int8
+-- also, check we get PgCasts for columns generated by PgStar
+-- also, check aggregation functions in projection subqueries
+select 3, * from (select 4::int8 as c1, max(b) as c from plato."Input") as t
+union all
+-- check PgQualifiedStar
+select 4, t.* from plato."Input" as t
+union all
+-- check if casts are there for aggregation functions used directly and in a projection
+select 5, min(a), (select min(b) from plato."Input") from plato."Input"
+order by 1, 2, 3
diff --git a/yql/essentials/tests/sql/suites/pg/select_except.sql b/yql/essentials/tests/sql/suites/pg/select_except.sql
new file mode 100644
index 0000000000..15213e93cb
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_except.sql
@@ -0,0 +1,12 @@
+--!syntax_pg
+select * from (values (1),(1),(1)) a(x)
+except
+select * from (values (1),(1)) a(x);
+
+select * from (values (1),(1)) a(x)
+except
+select * from (values (1),(1)) a(x);
+
+select * from (values (1),(1)) a(x)
+except
+select * from (values (1),(1),(1)) a(x); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_except_all.sql b/yql/essentials/tests/sql/suites/pg/select_except_all.sql
new file mode 100644
index 0000000000..4e423c8ea2
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_except_all.sql
@@ -0,0 +1,12 @@
+--!syntax_pg
+select * from (values (1),(1),(1),(1),(1)) a(x)
+except all
+select * from (values (1),(1)) a(x);
+
+select * from (values (1),(1)) a(x)
+except all
+select * from (values (1),(1)) a(x);
+
+select * from (values (1),(1)) a(x)
+except all
+select * from (values (1),(1),(1)) a(x); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_from_columns.sql b/yql/essentials/tests/sql/suites/pg/select_from_columns.sql
new file mode 100644
index 0000000000..26a9849a9f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_from_columns.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select a from plato."Input" u(a,b,c)
diff --git a/yql/essentials/tests/sql/suites/pg/select_from_columns_qstar.sql b/yql/essentials/tests/sql/suites/pg/select_from_columns_qstar.sql
new file mode 100644
index 0000000000..de80f5d467
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_from_columns_qstar.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select u.* from plato."Input" u(a,b,c)
diff --git a/yql/essentials/tests/sql/suites/pg/select_from_columns_scalar.sql b/yql/essentials/tests/sql/suites/pg/select_from_columns_scalar.sql
new file mode 100644
index 0000000000..1c86464d32
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_from_columns_scalar.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select a from (select 1) x(a)
diff --git a/yql/essentials/tests/sql/suites/pg/select_from_columns_star.sql b/yql/essentials/tests/sql/suites/pg/select_from_columns_star.sql
new file mode 100644
index 0000000000..1ae501d588
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_from_columns_star.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from plato."Input" u(a,b,c)
diff --git a/yql/essentials/tests/sql/suites/pg/select_having.sql b/yql/essentials/tests/sql/suites/pg/select_having.sql
new file mode 100644
index 0000000000..faba1d41f9
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_having.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select x,sum(y)
+from (values (1,2),(3,4),(3,5)) u(x,y)
+group by x
+having count(y)=2
diff --git a/yql/essentials/tests/sql/suites/pg/select_having_no_from.sql b/yql/essentials/tests/sql/suites/pg/select_having_no_from.sql
new file mode 100644
index 0000000000..b12c6fca4d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_having_no_from.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select 1 having count(*)=0;
+select 2 having count(*)=1; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_having_same_agg.sql b/yql/essentials/tests/sql/suites/pg/select_having_same_agg.sql
new file mode 100644
index 0000000000..2eb458681e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_having_same_agg.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select x,count(y)
+from (values (1,2),(3,4),(3,5)) u(x,y)
+group by x
+having count(y)=2
diff --git a/yql/essentials/tests/sql/suites/pg/select_intersect.sql b/yql/essentials/tests/sql/suites/pg/select_intersect.sql
new file mode 100644
index 0000000000..183b3cefb0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_intersect.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1),(1),(1)) a(x)
+intersect
+select * from (values (1),(1)) a(x);
+
+select * from (values (1),(1),(1)) a(x)
+intersect
+select * from (values (2)) a(x); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_intersect_all.sql b/yql/essentials/tests/sql/suites/pg/select_intersect_all.sql
new file mode 100644
index 0000000000..6d8e43fe13
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_intersect_all.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1),(1),(1)) a(x)
+intersect all
+select * from (values (1),(1)) a(x);
+
+select * from (values (1),(1),(1)) a(x)
+intersect all
+select * from (values (2)) a(x); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_is_null.sql b/yql/essentials/tests/sql/suites/pg/select_is_null.sql
new file mode 100644
index 0000000000..2a9bb97dbb
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_is_null.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 is null, 2 is not null, null is null, null is not null \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_cross.sql b/yql/essentials/tests/sql/suites/pg/select_join_cross.sql
new file mode 100644
index 0000000000..ec6f271cb0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_cross.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (values (1),(2)) q(x) cross join (values (3),(4)) u(y);
+select * from (values (1),(2)) q(x),(values (3),(4)) u(y); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_cross_and_inner.sql b/yql/essentials/tests/sql/suites/pg/select_join_cross_and_inner.sql
new file mode 100644
index 0000000000..caab400a0c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_cross_and_inner.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select * from (values (1),(2)) q(x) cross join (values (3),(4)) u(y) join (values (5),(6)) v(z) on v.z>u.y;
+select * from (values (3),(4)) u(y) join (values (5),(6)) v(z) on v.z>u.y cross join (values (1),(2)) q(x);
+select * from (values (1),(2)) q(x),(values (3),(4)) u(y) join (values (5),(6)) v(z) on v.z>u.y;
+select * from (values (3),(4)) u(y) join (values (5),(6)) v(z) on v.z>u.y,(values (1),(2)) q(x);
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_full.sql b/yql/essentials/tests/sql/suites/pg/select_join_full.sql
new file mode 100644
index 0000000000..2518366b32
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_full.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (select 1 as x ) u full join (select 1 as y) v on u.x=v.y;
+select * from (select 1 as x ) u full join (select 2 as y) v on u.x=v.y;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_full3.sql b/yql/essentials/tests/sql/suites/pg/select_join_full3.sql
new file mode 100644
index 0000000000..c00fc629a0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_full3.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (select 1 as x ) u full join (select 1 as y) v on u.x=v.y full join (select 1 as z) r on v.y=r.z;
+select * from (select 1 as x ) u full join (select 2 as y) v on u.x=v.y full join (select 3 as z) r on v.y=r.z;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_full_const.sql b/yql/essentials/tests/sql/suites/pg/select_join_full_const.sql
new file mode 100644
index 0000000000..605eb5c89c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_full_const.sql
@@ -0,0 +1,32 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on 1+1=2;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+full join (values (1,2),(2,5)) as b(u,v)
+on 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=2;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+full join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on 1+1=3;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+full join (values (1,2),(2,5)) as b(u,v)
+on 1+1=3;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=3;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+full join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=3;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_full_equi.sql b/yql/essentials/tests/sql/suites/pg/select_join_full_equi.sql
new file mode 100644
index 0000000000..6a1302a61b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_full_equi.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and b.v = a.y;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_full_equi_and_const.sql b/yql/essentials/tests/sql/suites/pg/select_join_full_equi_and_const.sql
new file mode 100644
index 0000000000..05f1ca4b14
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_full_equi_and_const.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and 1+1=3;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_full_equi_and_one.sql b/yql/essentials/tests/sql/suites/pg/select_join_full_equi_and_one.sql
new file mode 100644
index 0000000000..f6a40eeb3f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_full_equi_and_one.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and a.x=1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and b.u=1; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_full_one.sql b/yql/essentials/tests/sql/suites/pg/select_join_full_one.sql
new file mode 100644
index 0000000000..b5cdcb6967
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_full_one.sql
@@ -0,0 +1,16 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on a.x = 1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on a.x = 0;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on b.u = 1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+full join (values (1,2),(2,5)) as b(u,v)
+on b.u = 0;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_inner.sql b/yql/essentials/tests/sql/suites/pg/select_join_inner.sql
new file mode 100644
index 0000000000..ea9298b1e0
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_inner.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (select 1 as x) q join (select 1 as y) u on q.x=u.y;
+select * from (select 1 as x) q join (select 2 as y) u on q.x=u.y; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_inner3.sql b/yql/essentials/tests/sql/suites/pg/select_join_inner3.sql
new file mode 100644
index 0000000000..eedd9b9e0b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_inner3.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select * from (select 1 as x) q join (select 1 as y) u on q.x=u.y join (select 1 as z) v on v.z = q.x;
+select * from (select 1 as x) q join (select 2 as y) u on q.x=u.y join (select 3 as z) v on v.z = q.x;
+select * from (select 1 as x) q join (select 1 as y) u on q.x=u.y join (select 1 as z) v on v.z = u.y;
+select * from (select 1 as x) q join (select 2 as y) u on q.x=u.y join (select 3 as z) v on v.z = u.y; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_inner_const.sql b/yql/essentials/tests/sql/suites/pg/select_join_inner_const.sql
new file mode 100644
index 0000000000..1180d6ef64
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_inner_const.sql
@@ -0,0 +1,32 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (values (1,2),(2,5)) as b(u,v)
+on 1+1=2;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+inner join (values (1,2),(2,5)) as b(u,v)
+on 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=2;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+inner join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (values (1,2),(2,5)) as b(u,v)
+on 1+1=3;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+inner join (values (1,2),(2,5)) as b(u,v)
+on 1+1=3;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=3;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+inner join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=3;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_inner_equi.sql b/yql/essentials/tests/sql/suites/pg/select_join_inner_equi.sql
new file mode 100644
index 0000000000..ed348717e8
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_inner_equi.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and b.v = a.y;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_inner_equi_and_const.sql b/yql/essentials/tests/sql/suites/pg/select_join_inner_equi_and_const.sql
new file mode 100644
index 0000000000..a0fd63ba86
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_inner_equi_and_const.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and 1+1=3;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_inner_equi_and_one.sql b/yql/essentials/tests/sql/suites/pg/select_join_inner_equi_and_one.sql
new file mode 100644
index 0000000000..3086f40cd4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_inner_equi_and_one.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and a.x=1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and b.u=1; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_inner_one.sql b/yql/essentials/tests/sql/suites/pg/select_join_inner_one.sql
new file mode 100644
index 0000000000..803ce9ccaf
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_inner_one.sql
@@ -0,0 +1,16 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (values (1,2),(2,5)) as b(u,v)
+on a.x = 1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (values (1,2),(2,5)) as b(u,v)
+on a.x = 0;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (values (1,2),(2,5)) as b(u,v)
+on b.u = 1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+inner join (values (1,2),(2,5)) as b(u,v)
+on b.u = 0;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_left.sql b/yql/essentials/tests/sql/suites/pg/select_join_left.sql
new file mode 100644
index 0000000000..4190c29e5e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_left.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (select 1 as x ) u left join (select 1 as y) v on u.x=v.y;
+select * from (select 1 as x ) u left join (select 2 as y) v on u.x=v.y;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_left3.sql b/yql/essentials/tests/sql/suites/pg/select_join_left3.sql
new file mode 100644
index 0000000000..4a49f90169
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_left3.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (select 1 as x ) u left join (select 1 as y) v on u.x=v.y left join (select 1 as z) r on v.y=r.z;
+select * from (select 1 as x ) u left join (select 2 as y) v on u.x=v.y left join (select 3 as z) r on v.y=r.z;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_left_const.sql b/yql/essentials/tests/sql/suites/pg/select_join_left_const.sql
new file mode 100644
index 0000000000..225541d3a8
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_left_const.sql
@@ -0,0 +1,32 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on 1+1=2;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+left join (values (1,2),(2,5)) as b(u,v)
+on 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=2;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+left join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on 1+1=3;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+left join (values (1,2),(2,5)) as b(u,v)
+on 1+1=3;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=3;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+left join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=3;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_left_equi.sql b/yql/essentials/tests/sql/suites/pg/select_join_left_equi.sql
new file mode 100644
index 0000000000..1572be7b53
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_left_equi.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and b.v = a.y;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_left_equi_and_const.sql b/yql/essentials/tests/sql/suites/pg/select_join_left_equi_and_const.sql
new file mode 100644
index 0000000000..34d2ce1fe5
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_left_equi_and_const.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and 1+1=3;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_left_equi_and_one.sql b/yql/essentials/tests/sql/suites/pg/select_join_left_equi_and_one.sql
new file mode 100644
index 0000000000..4e44ae8edc
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_left_equi_and_one.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and a.x=1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and b.u=1; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_left_one.sql b/yql/essentials/tests/sql/suites/pg/select_join_left_one.sql
new file mode 100644
index 0000000000..d10f91976e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_left_one.sql
@@ -0,0 +1,16 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on a.x = 1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on a.x = 0;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on b.u = 1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+left join (values (1,2),(2,5)) as b(u,v)
+on b.u = 0;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_qstar.sql b/yql/essentials/tests/sql/suites/pg/select_join_qstar.sql
new file mode 100644
index 0000000000..2935c425a8
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_qstar.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select * from (select 1 as x) a inner join (select 1 as y) b on a.x=b.y;
+select x from (select 1 as x) a inner join (select 1 as y) b on a.x=b.y;
+select a.x from (select 1 as x) a inner join (select 1 as y) b on a.x=b.y;
+select a.* from (select 1 as x) a inner join (select 1 as y) b on a.x=b.y; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_right.sql b/yql/essentials/tests/sql/suites/pg/select_join_right.sql
new file mode 100644
index 0000000000..aa9ebf27b4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_right.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (select 1 as x ) u right join (select 1 as y) v on u.x=v.y;
+select * from (select 1 as x ) u right join (select 2 as y) v on u.x=v.y;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_right3.sql b/yql/essentials/tests/sql/suites/pg/select_join_right3.sql
new file mode 100644
index 0000000000..0e54a61e12
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_right3.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (select 1 as x ) u right join (select 1 as y) v on u.x=v.y right join (select 1 as z) r on v.y=r.z;
+select * from (select 1 as x ) u right join (select 2 as y) v on u.x=v.y right join (select 3 as z) r on v.y=r.z;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_right_const.sql b/yql/essentials/tests/sql/suites/pg/select_join_right_const.sql
new file mode 100644
index 0000000000..7e77f16485
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_right_const.sql
@@ -0,0 +1,32 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on 1+1=2;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+right join (values (1,2),(2,5)) as b(u,v)
+on 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=2;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+right join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on 1+1=3;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+right join (values (1,2),(2,5)) as b(u,v)
+on 1+1=3;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=3;
+
+select * from (select * from (values (1,2),(3,4)) as a(x,y) limit 0) a
+right join (select * from (values (1,2),(2,5)) as b(u,v) limit 0) b
+on 1+1=3;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_right_equi.sql b/yql/essentials/tests/sql/suites/pg/select_join_right_equi.sql
new file mode 100644
index 0000000000..027ffc83d8
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_right_equi.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and b.v = a.y;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_right_equi_and_const.sql b/yql/essentials/tests/sql/suites/pg/select_join_right_equi_and_const.sql
new file mode 100644
index 0000000000..0c9e283c0f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_right_equi_and_const.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and 1+1=2;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and 1+1=3;
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_right_equi_and_one.sql b/yql/essentials/tests/sql/suites/pg/select_join_right_equi_and_one.sql
new file mode 100644
index 0000000000..a3cb350b25
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_right_equi_and_one.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and a.x=1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on a.x = b.u and b.u=1; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_join_right_one.sql b/yql/essentials/tests/sql/suites/pg/select_join_right_one.sql
new file mode 100644
index 0000000000..073b28e334
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_join_right_one.sql
@@ -0,0 +1,16 @@
+--!syntax_pg
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on a.x = 1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on a.x = 0;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on b.u = 1;
+
+select * from (values (1,2),(3,4)) as a(x,y)
+right join (values (1,2),(2,5)) as b(u,v)
+on b.u = 0;
diff --git a/yql/essentials/tests/sql/suites/pg/select_limit.sql b/yql/essentials/tests/sql/suites/pg/select_limit.sql
new file mode 100644
index 0000000000..a8c47d63f5
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_limit.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from plato."Input" limit 2 offset 1 \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_literals.sql b/yql/essentials/tests/sql/suites/pg/select_literals.sql
new file mode 100644
index 0000000000..2f4c83f234
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_literals.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 as y, 2 as x;
diff --git a/yql/essentials/tests/sql/suites/pg/select_plusminus.sql b/yql/essentials/tests/sql/suites/pg/select_plusminus.sql
new file mode 100644
index 0000000000..ff2ec584f4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_plusminus.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1+2-3;
diff --git a/yql/essentials/tests/sql/suites/pg/select_plusminus_unary.sql b/yql/essentials/tests/sql/suites/pg/select_plusminus_unary.sql
new file mode 100644
index 0000000000..7d47ef8f6b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_plusminus_unary.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select -x,+x from (select 1 as x) u; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_expr.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_expr.sql
new file mode 100644
index 0000000000..b00a8b3d01
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_expr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select distinct on (1)
+x+1
+from (values (3),(2),(1),(2)) a(x)
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_qstar.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_qstar.sql
new file mode 100644
index 0000000000..6bf58bbd74
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_qstar.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select distinct on (1)
+a.*
+from (values (3),(2),(1),(2)) a(x)
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_star.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_star.sql
new file mode 100644
index 0000000000..231107eac9
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_distinct_on_star.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select distinct on (1)
+*
+from (values (3),(2),(1),(2)) a(x)
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_col.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_col.sql
new file mode 100644
index 0000000000..b12248d87a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_col.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select
+x
+from (values (3),(2),(1),(2)) a(x)
+group by 1
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_expr.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_expr.sql
new file mode 100644
index 0000000000..4f04831613
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_expr.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select
+x+1
+from (values (3),(2),(1),(2)) a(x)
+group by 1
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_qcol.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_qcol.sql
new file mode 100644
index 0000000000..1834610a78
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_qcol.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select
+a.x
+from (values (3),(2),(1),(2)) a(x)
+group by 1
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_qstar.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_qstar.sql
new file mode 100644
index 0000000000..63dbd0f527
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_qstar.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select
+a.*
+from (values (3),(2),(1),(2)) a(x)
+group by 1
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_star.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_star.sql
new file mode 100644
index 0000000000..f1b7102844
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_group_by_star.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select
+*
+from (values (3),(2),(1),(2)) a(x)
+group by 1
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_expr.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_expr.sql
new file mode 100644
index 0000000000..479d3dc3f9
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_expr.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select
+x+1
+from (values (3),(2),(1),(2)) a(x)
+order by 1
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_qstar.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_qstar.sql
new file mode 100644
index 0000000000..7302876326
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_qstar.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select
+a.*
+from (values (3),(2),(1),(2)) a(x)
+order by 1
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_star.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_star.sql
new file mode 100644
index 0000000000..51e61c1c9b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_star.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select
+*
+from (values (3),(2),(1),(2)) a(x)
+order by 1
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_union_all_expr.sql b/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_union_all_expr.sql
new file mode 100644
index 0000000000..364214823f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_proj_ref_order_by_union_all_expr.sql
@@ -0,0 +1,10 @@
+--!syntax_pg
+select
+x+1
+from (values (3),(2),(1),(2)) a(x)
+union all
+select
+x-1
+from (values (30),(20),(10),(20)) a(x)
+order by 1
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_qstarref1.sql b/yql/essentials/tests/sql/suites/pg/select_qstarref1.sql
new file mode 100644
index 0000000000..71a0b26b95
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_qstarref1.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select a.*,1,value as foo from plato."Input" as a;
diff --git a/yql/essentials/tests/sql/suites/pg/select_qstarref2.sql b/yql/essentials/tests/sql/suites/pg/select_qstarref2.sql
new file mode 100644
index 0000000000..be8829bd85
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_qstarref2.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select a.*,b.* from plato."Input" as a,plato."Input2" as b;
diff --git a/yql/essentials/tests/sql/suites/pg/select_sort_project_expr.sql b/yql/essentials/tests/sql/suites/pg/select_sort_project_expr.sql
new file mode 100644
index 0000000000..3bd163fc5b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_sort_project_expr.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select -x as x from (values (1),(2)) u(x) order by -x
diff --git a/yql/essentials/tests/sql/suites/pg/select_sort_project_new.sql b/yql/essentials/tests/sql/suites/pg/select_sort_project_new.sql
new file mode 100644
index 0000000000..3b2421e0ea
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_sort_project_new.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select -x as y from (values (1),(2)) u(x) order by y
diff --git a/yql/essentials/tests/sql/suites/pg/select_sort_project_same.sql b/yql/essentials/tests/sql/suites/pg/select_sort_project_same.sql
new file mode 100644
index 0000000000..1851b1cd2b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_sort_project_same.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select -x as x from (values (1),(2)) u(x) order by x
diff --git a/yql/essentials/tests/sql/suites/pg/select_sort_project_same_asc.sql b/yql/essentials/tests/sql/suites/pg/select_sort_project_same_asc.sql
new file mode 100644
index 0000000000..5a3f3b19db
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_sort_project_same_asc.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select -x as x from (values (1),(2)) u(x) order by x asc
diff --git a/yql/essentials/tests/sql/suites/pg/select_sort_project_same_desc.sql b/yql/essentials/tests/sql/suites/pg/select_sort_project_same_desc.sql
new file mode 100644
index 0000000000..ca33d06b5b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_sort_project_same_desc.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select -x as x from (values (1),(2)) u(x) order by x desc
diff --git a/yql/essentials/tests/sql/suites/pg/select_starref1.sql b/yql/essentials/tests/sql/suites/pg/select_starref1.sql
new file mode 100644
index 0000000000..cab5016734
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_starref1.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from plato."Input";
diff --git a/yql/essentials/tests/sql/suites/pg/select_starref2.sql b/yql/essentials/tests/sql/suites/pg/select_starref2.sql
new file mode 100644
index 0000000000..7d4e1b9ec6
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_starref2.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from plato."Input", plato."Input2";
diff --git a/yql/essentials/tests/sql/suites/pg/select_subquery.sql b/yql/essentials/tests/sql/suites/pg/select_subquery.sql
new file mode 100644
index 0000000000..f8f6899b72
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_subquery.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from (select value,key from plato."Input") a
diff --git a/yql/essentials/tests/sql/suites/pg/select_subquery2.sql b/yql/essentials/tests/sql/suites/pg/select_subquery2.sql
new file mode 100644
index 0000000000..ba11590f6c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_subquery2.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from (select * from plato."Input") a, (select * from plato."Input2") b;
diff --git a/yql/essentials/tests/sql/suites/pg/select_subquery2_qstar.sql b/yql/essentials/tests/sql/suites/pg/select_subquery2_qstar.sql
new file mode 100644
index 0000000000..7d5a5e46e1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_subquery2_qstar.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select b.*,a.* from (select * from plato."Input") a, (select * from plato."Input2") b;
diff --git a/yql/essentials/tests/sql/suites/pg/select_subquery_scalar.sql b/yql/essentials/tests/sql/suites/pg/select_subquery_scalar.sql
new file mode 100644
index 0000000000..b097f6cbf1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_subquery_scalar.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from (select 1 as y, 2 as x) a
diff --git a/yql/essentials/tests/sql/suites/pg/select_subquery_scalar2.sql b/yql/essentials/tests/sql/suites/pg/select_subquery_scalar2.sql
new file mode 100644
index 0000000000..2fdbeb6f71
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_subquery_scalar2.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from (select 1 as y) a, (select 2 as x) b
diff --git a/yql/essentials/tests/sql/suites/pg/select_subquery_scalar2_qstar.sql b/yql/essentials/tests/sql/suites/pg/select_subquery_scalar2_qstar.sql
new file mode 100644
index 0000000000..850814d15b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_subquery_scalar2_qstar.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select b.*,a.* from (select 1 as y) a, (select 2 as x) b
diff --git a/yql/essentials/tests/sql/suites/pg/select_substring.sql b/yql/essentials/tests/sql/suites/pg/select_substring.sql
new file mode 100644
index 0000000000..98197d1ea6
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_substring.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select substring('привет',3,3) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_table1.sql b/yql/essentials/tests/sql/suites/pg/select_table1.sql
new file mode 100644
index 0000000000..ef66a44482
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_table1.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 from plato."Input";
diff --git a/yql/essentials/tests/sql/suites/pg/select_table2.sql b/yql/essentials/tests/sql/suites/pg/select_table2.sql
new file mode 100644
index 0000000000..d430b624f5
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_table2.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 from plato."Input", plato."Input2";
diff --git a/yql/essentials/tests/sql/suites/pg/select_union.sql b/yql/essentials/tests/sql/suites/pg/select_union.sql
new file mode 100644
index 0000000000..5cb2640b4e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_union.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select * from (values (1),(1),(1)) a(x)
+union
+select * from (values (1),(1)) a(x);
+
+select * from (values (1),(1),(1)) a(x)
+union
+select * from (values (2)) a(x); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_unionall_scalar.sql b/yql/essentials/tests/sql/suites/pg/select_unionall_scalar.sql
new file mode 100644
index 0000000000..a7f95a1e48
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_unionall_scalar.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select * from (select 1 as x, 3 as y) u
+union all
+select * from (select null::int4 as y, 2 as x) v
+union all
+select * from (select 4 as y, null::int4 as x) v
diff --git a/yql/essentials/tests/sql/suites/pg/select_unionall_self.sql b/yql/essentials/tests/sql/suites/pg/select_unionall_self.sql
new file mode 100644
index 0000000000..f0f8968796
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_unionall_self.sql
@@ -0,0 +1,6 @@
+--!syntax_pg
+select * from plato."Input"
+union all
+select * from plato."Input"
+union all
+select * from plato."Input";
diff --git a/yql/essentials/tests/sql/suites/pg/select_where.sql b/yql/essentials/tests/sql/suites/pg/select_where.sql
new file mode 100644
index 0000000000..c7db84240d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_where.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from plato."Input" where key = '800' or not (key < '999')
diff --git a/yql/essentials/tests/sql/suites/pg/select_where_scalar.sql b/yql/essentials/tests/sql/suites/pg/select_where_scalar.sql
new file mode 100644
index 0000000000..3fbc7545b2
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_where_scalar.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 where 2=null::int4 and true or false
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_column_order_by.sql b/yql/essentials/tests/sql/suites/pg/select_win_column_order_by.sql
new file mode 100644
index 0000000000..f31997f49b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_column_order_by.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select x,rank() over (order by y) rnk from (select 1 x,2 y) a \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_column_partition_by.sql b/yql/essentials/tests/sql/suites/pg/select_win_column_partition_by.sql
new file mode 100644
index 0000000000..761ed9b225
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_column_partition_by.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select x,rank() over (partition by y) rnk from (select 1 x,2 y) a \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_count.sql b/yql/essentials/tests/sql/suites/pg/select_win_count.sql
new file mode 100644
index 0000000000..ae8c9cce1c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_count.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select x,y,count(x) over w
+from (values (1,2),(null::int4,3),(2,4),(2,5)) as a(x,y)
+window w as ();
+
+select x,y,count(x) over w
+from (values (1,2),(null::int4,3),(2,4),(2,5)) as a(x,y)
+window w as (order by y);
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_count_all.sql b/yql/essentials/tests/sql/suites/pg/select_win_count_all.sql
new file mode 100644
index 0000000000..63296342ee
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_count_all.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select x,y,count(*) over w
+from (values (1,2),(1,3),(2,4),(2,5)) as a(x,y)
+window w as ();
+
+select x,y,count(*) over w
+from (values (1,2),(1,3),(2,4),(2,5)) as a(x,y)
+window w as (order by y);
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_cume_dist.sql b/yql/essentials/tests/sql/suites/pg/select_win_cume_dist.sql
new file mode 100644
index 0000000000..315f428496
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_cume_dist.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+SELECT cume_dist() over w FROM (VALUES (4),(5),(5),(6)) as a(x)
+window w as (ORDER BY x ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_expr_agg.sql b/yql/essentials/tests/sql/suites/pg/select_win_expr_agg.sql
new file mode 100644
index 0000000000..825d2ced08
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_expr_agg.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+select sum(x+1 + sum(z)) over w as l from (
+ values (1,2,3),(1,5,3)) a(x,y,z)
+group by x+1,y
+window w as (
+)
+order by l
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_expr_agg_order.sql b/yql/essentials/tests/sql/suites/pg/select_win_expr_agg_order.sql
new file mode 100644
index 0000000000..cacec89c0e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_expr_agg_order.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select sum(x+1 + sum(z)) over w as l from (
+ values (1,2,3),(1,5,3)) a(x,y,z)
+group by x+1,y
+window w as (
+ order by x+1 + sum(z)
+)
+order by l
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_expr_lead.sql b/yql/essentials/tests/sql/suites/pg/select_win_expr_lead.sql
new file mode 100644
index 0000000000..09708f56ec
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_expr_lead.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+select lead(x+1 + sum(z)) over w as l from (
+ values (1,2,3),(1,5,3)) a(x,y,z)
+group by x+1,y
+window w as (
+)
+order by l
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_expr_order.sql b/yql/essentials/tests/sql/suites/pg/select_win_expr_order.sql
new file mode 100644
index 0000000000..8dbf711b67
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_expr_order.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select row_number() over w as l from (
+ values (1,2,3),(1,5,3)) a(x,y,z)
+group by x+1,y
+window w as (
+ order by x+1 + sum(z)
+)
+order by l
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_expr_partition.sql b/yql/essentials/tests/sql/suites/pg/select_win_expr_partition.sql
new file mode 100644
index 0000000000..47288c6cd4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_expr_partition.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select row_number() over w as l from (
+ values (1,2,3),(1,5,3)) a(x,y,z)
+group by x+1,y
+window w as (
+ partition by x+1 + sum(z)
+)
+order by l
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_first_last_value.sql b/yql/essentials/tests/sql/suites/pg/select_win_first_last_value.sql
new file mode 100644
index 0000000000..392517a0c5
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_first_last_value.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select x,first_value(x) over w,last_value(x) over w
+from (values (1),(2),(2),(3)) as a(x)
+window w as (order by x)
+order by x \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_frame.sql b/yql/essentials/tests/sql/suites/pg/select_win_frame.sql
new file mode 100644
index 0000000000..beb43d6d8a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_frame.sql
@@ -0,0 +1,18 @@
+--!syntax_pg
+select
+x,
+sum(x) over (order by x rows between unbounded preceding and 1 preceding) as upp,
+sum(x) over (order by x rows between unbounded preceding and current row) as upc,
+sum(x) over (order by x rows between unbounded preceding and 1 following) as upf,
+sum(x) over (order by x rows between unbounded preceding and unbounded following) as upuf,
+sum(x) over (order by x rows between 2 preceding and 1 preceding) as pp,
+sum(x) over (order by x rows between 2 preceding and current row) as pc,
+sum(x) over (order by x rows between 2 preceding and 1 following) as pf,
+sum(x) over (order by x rows between 2 preceding and unbounded following) as puf,
+sum(x) over (order by x rows between current row and current row) as cc,
+sum(x) over (order by x rows between current row and 1 following) as cf,
+sum(x) over (order by x rows between current row and unbounded following) as cuf,
+sum(x) over (order by x rows between 1 following and 2 following) as ff,
+sum(x) over (order by x rows between 1 following and unbounded following) as fuf
+from (values (1),(2),(3),(4),(5),(6),(7)) a(x)
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_lead_lag.sql b/yql/essentials/tests/sql/suites/pg/select_win_lead_lag.sql
new file mode 100644
index 0000000000..1938a1bc6b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_lead_lag.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select x,lead(x) over w,lag(x) over w
+from (values (3),(4),(5)) as a(x)
+window w as ()
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_max.sql b/yql/essentials/tests/sql/suites/pg/select_win_max.sql
new file mode 100644
index 0000000000..64bb771e85
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_max.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select x,y,max(x) over w
+from (values (1,2),(1,3),(2,4),(2,5)) as a(x,y)
+window w as ();
+
+select x,y,max(x) over w
+from (values (1,2),(1,3),(2,4),(2,5)) as a(x,y)
+window w as (order by y);
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_max_null.sql b/yql/essentials/tests/sql/suites/pg/select_win_max_null.sql
new file mode 100644
index 0000000000..69ffb29ab1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_max_null.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select x,y,max(x) over w
+from (values (1,2),(null::int4,3),(2,4),(2,5)) as a(x,y)
+window w as ();
+
+select x,y,max(x) over w
+from (values (1,2),(null::int4,3),(2,4),(2,5)) as a(x,y)
+window w as (order by y);
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_min.sql b/yql/essentials/tests/sql/suites/pg/select_win_min.sql
new file mode 100644
index 0000000000..e9e2dca480
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_min.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select x,y,min(x) over w
+from (values (1,2),(1,3),(2,4),(2,5)) as a(x,y)
+window w as ();
+
+select x,y,min(x) over w
+from (values (1,2),(1,3),(2,4),(2,5)) as a(x,y)
+window w as (order by y);
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_min_null.sql b/yql/essentials/tests/sql/suites/pg/select_win_min_null.sql
new file mode 100644
index 0000000000..0fbd5f1691
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_min_null.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select x,y,min(x) over w
+from (values (1,2),(null::int4,3),(2,4),(2,5)) as a(x,y)
+window w as ();
+
+select x,y,min(x) over w
+from (values (1,2),(null::int4,3),(2,4),(2,5)) as a(x,y)
+window w as (order by y);
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_nth_value.sql b/yql/essentials/tests/sql/suites/pg/select_win_nth_value.sql
new file mode 100644
index 0000000000..209a23405d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_nth_value.sql
@@ -0,0 +1,11 @@
+--!syntax_pg
+select
+r,x,
+nth_value(x,1) over w as nr1,
+nth_value(x,2) over w as nr2,
+nth_value(x,3) over w as nr3,
+nth_value(x,4) over w as nr4
+from (values (1,3),(2,null),(3,4),(4,5)) as a(r,x)
+window w as (order by r)
+order by r
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_ntile.sql b/yql/essentials/tests/sql/suites/pg/select_win_ntile.sql
new file mode 100644
index 0000000000..42f69b3e57
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_ntile.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select
+r,x,
+ntile(3) over w
+from (select * from (values (1,3),(2,null),(3,4),(4,5)) as a(r,x)) as z
+window w as (order by r)
+order by r
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_partition_sort.sql b/yql/essentials/tests/sql/suites/pg/select_win_partition_sort.sql
new file mode 100644
index 0000000000..ba23d74177
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_partition_sort.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+select x,y,lead(y) over w,lag(y) over w
+from (values (1,2),(1,3),(2,4),(2,5)) as a(x,y)
+window w as (partition by a.x order by a.y desc)
+order by x,y;
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_percent_rank.sql b/yql/essentials/tests/sql/suites/pg/select_win_percent_rank.sql
new file mode 100644
index 0000000000..e0ccd1c450
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_percent_rank.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select
+r,x,
+percent_rank() over w
+from (select * from (values (1,null),(2,3),(3,4),(4,4)) as a(r,x)) as z
+window w as (order by r)
+order by r
+
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_rank.sql b/yql/essentials/tests/sql/suites/pg/select_win_rank.sql
new file mode 100644
index 0000000000..4734a855ca
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_rank.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select x,rank() over w,dense_rank() over w
+from (values (1),(2),(2),(3)) as a(x)
+window w as ()
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_rank_order.sql b/yql/essentials/tests/sql/suites/pg/select_win_rank_order.sql
new file mode 100644
index 0000000000..214a7e8496
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_rank_order.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select x,rank() over w,dense_rank() over w
+from (values (1),(2),(2),(3)) as a(x)
+window w as (order by x)
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_row_number.sql b/yql/essentials/tests/sql/suites/pg/select_win_row_number.sql
new file mode 100644
index 0000000000..deb68ea9d4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_row_number.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select x,row_number() over w r1,row_number() over () r2
+from (values (3),(5)) as a(x)
+window w as ()
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_sum.sql b/yql/essentials/tests/sql/suites/pg/select_win_sum.sql
new file mode 100644
index 0000000000..89e8656a09
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_sum.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select x,y,sum(x) over w
+from (values (1,2),(1,3),(2,4),(2,5)) as a(x,y)
+window w as ();
+
+select x,y,sum(x) over w
+from (values (1,2),(1,3),(2,4),(2,5)) as a(x,y)
+window w as (order by y);
diff --git a/yql/essentials/tests/sql/suites/pg/select_win_sum_null.sql b/yql/essentials/tests/sql/suites/pg/select_win_sum_null.sql
new file mode 100644
index 0000000000..f0948aed20
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_win_sum_null.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+select x,y,sum(x) over w
+from (values (1,2),(null::int4,3),(2,4),(2,5)) as a(x,y)
+window w as ();
+
+select x,y,sum(x) over w
+from (values (1,2),(null::int4,3),(2,4),(2,5)) as a(x,y)
+window w as (order by y);
diff --git a/yql/essentials/tests/sql/suites/pg/select_yql_type.cfg b/yql/essentials/tests/sql/suites/pg/select_yql_type.cfg
new file mode 100644
index 0000000000..0ca1ef5bf1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_yql_type.cfg
@@ -0,0 +1 @@
+in Input input_name.txt
diff --git a/yql/essentials/tests/sql/suites/pg/select_yql_type.sql b/yql/essentials/tests/sql/suites/pg/select_yql_type.sql
new file mode 100644
index 0000000000..18574a079b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/select_yql_type.sql
@@ -0,0 +1,15 @@
+--!syntax_pg
+SELECT
+ key, index, index + 1
+FROM plato."Input"
+ORDER BY index;
+
+SELECT
+ *
+FROM plato."Input"
+ORDER BY index;
+
+SELECT
+ t.*
+FROM plato."Input" as t
+ORDER BY index;
diff --git a/yql/essentials/tests/sql/suites/pg/set_of_as_records.cfg b/yql/essentials/tests/sql/suites/pg/set_of_as_records.cfg
new file mode 100644
index 0000000000..bb349dd8ab
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/set_of_as_records.cfg
@@ -0,0 +1 @@
+providers yt
diff --git a/yql/essentials/tests/sql/suites/pg/set_of_as_records.sql b/yql/essentials/tests/sql/suites/pg/set_of_as_records.sql
new file mode 100644
index 0000000000..f205c5f947
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/set_of_as_records.sql
@@ -0,0 +1 @@
+select Pg::json_each(pgjson('{"a":"foo", "b":"bar"}')) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/set_of_as_structs.sql b/yql/essentials/tests/sql/suites/pg/set_of_as_structs.sql
new file mode 100644
index 0000000000..06242eeaa9
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/set_of_as_structs.sql
@@ -0,0 +1,2 @@
+SELECT * FROM
+ AS_TABLE(PgRangeCall("json_each", pgjson('{"a":"foo", "b":"bar"}'))); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/set_over_unhashable.sql b/yql/essentials/tests/sql/suites/pg/set_over_unhashable.sql
new file mode 100644
index 0000000000..e7eb38835c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/set_over_unhashable.sql
@@ -0,0 +1 @@
+select DictKeys(ToSet([<|a:pgbit('10')|>,<|a:pgbit('01')|>,<|a:pgbit('01')|>]))
diff --git a/yql/essentials/tests/sql/suites/pg/simple_ops.sql b/yql/essentials/tests/sql/suites/pg/simple_ops.sql
new file mode 100644
index 0000000000..9c063ec257
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/simple_ops.sql
@@ -0,0 +1,18 @@
+select 1p + 2p, +(1p), -(1p), 1p - 2p, 3p * 4p, 7p / 4p, 7p % 4p, "a"p || "b"p,
+ pgdate('2001-09-28')+7,
+ pgdate('2001-09-28') + pginterval('1 hour'),
+ pgdate('2001-09-28') + pgtime('03:00'),
+ pginterval('1 day') + pginterval('1 hour'),
+ pgtimestamp('2001-09-28 01:00') + pginterval('23 hours'),
+ pgtime('01:00') + pginterval('3 hours'),
+ -pginterval('23 hours'),
+ pgdate('2001-10-01') - pgdate('2001-09-28'),
+ pgdate('2001-10-01') - 7,
+ pgdate('2001-09-28') - pginterval('1 hour'),
+ pgtime('05:00') - pgtime('03:00'),
+ pgtime('05:00') - pginterval('2 hours'),
+ pgtimestamp('2001-09-28 23:00') - pginterval('23 hours'),
+ pginterval('1 day') - pginterval('1 hour'),
+ pgtimestamp('2001-09-29 03:00') - pgtimestamp('2001-07-27 12:00'),
+ pginterval('1 second') * 900.0,
+ pginterval('1 hour') / 1.5; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/single_input_filter_over_join.sql b/yql/essentials/tests/sql/suites/pg/single_input_filter_over_join.sql
new file mode 100644
index 0000000000..34d4c134a9
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/single_input_filter_over_join.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select * from (select 1 as x) as a, (select 1 as y) as b, (select 1 as z) as c where a.x = 1;
+
+
diff --git a/yql/essentials/tests/sql/suites/pg/sort_nulls_priority.sql b/yql/essentials/tests/sql/suites/pg/sort_nulls_priority.sql
new file mode 100644
index 0000000000..f6b31a0cb2
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sort_nulls_priority.sql
@@ -0,0 +1,13 @@
+--!syntax_pg
+SELECT
+*
+FROM
+(VALUES (null),(3),(1),(2)) as a(x)
+ORDER BY x nulls last;
+
+SELECT
+*
+FROM
+(VALUES (null),(3),(1),(2)) as a(x)
+ORDER BY x nulls first;
+
diff --git a/yql/essentials/tests/sql/suites/pg/sort_nulls_priority_window.sql b/yql/essentials/tests/sql/suites/pg/sort_nulls_priority_window.sql
new file mode 100644
index 0000000000..7659657828
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sort_nulls_priority_window.sql
@@ -0,0 +1,13 @@
+--!syntax_pg
+SELECT
+x,array_agg(x) over (order by x nulls first)
+FROM
+(VALUES (null),(3),(1),(2)) a(x)
+ORDER BY x nulls first;
+
+SELECT
+x,array_agg(x) over (order by x nulls last)
+FROM
+(VALUES (null),(3),(1),(2)) a(x)
+ORDER BY x nulls last;
+
diff --git a/yql/essentials/tests/sql/suites/pg/str_lookup_pg.sql b/yql/essentials/tests/sql/suites/pg/str_lookup_pg.sql
new file mode 100644
index 0000000000..750cd6281f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/str_lookup_pg.sql
@@ -0,0 +1,22 @@
+pragma warning("disable", "4510");
+
+select StartsWith('test1'u, 'tes'p),
+ EndsWith('test1'u, 't1'p),
+ YQL::StringContains('test1'u, 'est'p);
+
+select StartsWith('test1'u, 'tes'pb),
+ EndsWith('test1'u, 't1'pb),
+ YQL::StringContains('test1'u, 'est'pb);
+
+select StartsWith('test1', 'tes'p),
+ EndsWith('test1', 't1'p),
+ YQL::StringContains('test1', 'est'p);
+
+select StartsWith('test1', 'tes'pv),
+ EndsWith('test1', 't1'pv),
+ YQL::StringContains('test1', 'est'pv);
+
+select StartsWith('test1'u, 'x'pv),
+ EndsWith(Nothing(Utf8?), 'x'pv),
+ YQL::StringContains('test1'u, PgCast(null, PgVarChar));
+
diff --git a/yql/essentials/tests/sql/suites/pg/strings_to_pg.sql b/yql/essentials/tests/sql/suites/pg/strings_to_pg.sql
new file mode 100644
index 0000000000..ac2eccfa60
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/strings_to_pg.sql
@@ -0,0 +1,11 @@
+select ToPg("foo"),ToPg(Utf8("bar")),ToPg(Yson("<a=1>[]")),ToPg(Json('{"a":1}')),ToPg(JsonDocument("[1,2,3]")),
+ ToPg(Uuid('12345678-9abc-def0-1234-567890123456')),
+ ToPg(TzDate("2001-02-03,Europe/Moscow")),
+ ToPg(TzDatetime("2001-02-03T04:05:06,Europe/Moscow")),
+ ToPg(TzTimestamp("2001-02-03T04:05:06.789012,Europe/Moscow")),
+ ToPg(TzDate32("1901-02-03,Europe/Moscow")),
+ ToPg(TzDatetime64("1901-02-03T04:05:06,Europe/Moscow")),
+ ToPg(TzTimestamp64("1901-02-03T04:05:06.789012,Europe/Moscow"));
+
+
+
diff --git a/yql/essentials/tests/sql/suites/pg/struct_tuple_cast.sql b/yql/essentials/tests/sql/suites/pg/struct_tuple_cast.sql
new file mode 100644
index 0000000000..abc59e540c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/struct_tuple_cast.sql
@@ -0,0 +1,9 @@
+/* postgres can not */
+/* dq can not */
+/* dqfile can not */
+
+$s = <|foo:1p|>;
+$t = (1p,);
+
+select cast($s as Struct<a:PgText,b:PgInt4,c:_PgText,foo:PgInt4>);
+select cast($t as Tuple<PgInt4,PgText,_PgText>);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_columns_in_test_expr_columns.sql b/yql/essentials/tests/sql/suites/pg/sublink_columns_in_test_expr_columns.sql
new file mode 100644
index 0000000000..1eb3fc829d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_columns_in_test_expr_columns.sql
@@ -0,0 +1,11 @@
+--!syntax_pg
+select x = any (select 1)
+from (values (1,1),(2,5),(3,4)) a(x,y);
+
+select *
+from (values (1,1),(2,5),(3,4)) a(x,y)
+where x = all (select 1);
+
+select 1
+from (values (1,1),(2,5),(3,4)) a(x,y)
+order by x in (select 1); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_columns_in_test_expr_columns_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_columns_in_test_expr_columns_corr.sql
new file mode 100644
index 0000000000..481a7775d4
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_columns_in_test_expr_columns_corr.sql
@@ -0,0 +1,11 @@
+--!syntax_pg
+select x = any (select x)
+from (values (1,1),(2,5),(3,4)) a(x,y);
+
+select *
+from (values (1,1),(2,5),(3,4)) a(x,y)
+where x = all (select x);
+
+select 1
+from (values (1,1),(2,5),(3,4)) a(x,y)
+order by x in (select x); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_having_all.sql b/yql/essentials/tests/sql/suites/pg/sublink_having_all.sql
new file mode 100644
index 0000000000..6c1de30d5b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_having_all.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select 1 from (select 10 as x) a having min(x) > all (values (1),(2));
+select 1 from (select 2 as x) a having min(x) > all (values (1),(2));
+select 1 from (select 1 as x) a having min(x) > all (select 1 limit 0);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_having_any.sql b/yql/essentials/tests/sql/suites/pg/sublink_having_any.sql
new file mode 100644
index 0000000000..363940773b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_having_any.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select 1 from (select 10 as x) a having min(x) > any (values (1),(2));
+select 1 from (select 2 as x) a having min(x) > any (values (1),(2));
+select 1 from (select 1 as x) a having min(x) > any (select 1 limit 0);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_having_exists.sql b/yql/essentials/tests/sql/suites/pg/sublink_having_exists.sql
new file mode 100644
index 0000000000..cea23512c9
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_having_exists.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select 1 from (select 1 as x) a having exists (select 1,2);
+select 1 from (select 1 as x) a having exists (select 1,2 limit 0);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_having_expr.sql b/yql/essentials/tests/sql/suites/pg/sublink_having_expr.sql
new file mode 100644
index 0000000000..0cfa288f18
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_having_expr.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 from (select 1 as x) a having min(x) = (select 1);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_having_in.sql b/yql/essentials/tests/sql/suites/pg/sublink_having_in.sql
new file mode 100644
index 0000000000..184cac17d1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_having_in.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select 1 from (select 10 as x) a having min(x) in (values (1),(2));
+select 1 from (select 2 as x) a having min(x) in (values (1),(2));
+select 1 from (select 1 as x) a having min(x) in (select 1 limit 0);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_order_all_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_order_all_corr.sql
new file mode 100644
index 0000000000..3c0a30649d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_order_all_corr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select x,y
+from (values (1,1),(2,5),(3,4)) a(x,y)
+order by 2 <> all (select x),y \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_order_any_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_order_any_corr.sql
new file mode 100644
index 0000000000..1146b23674
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_order_any_corr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select x,y
+from (values (1,1),(2,5),(3,4)) a(x,y)
+order by 2 <> any (select x),y \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_order_exists_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_order_exists_corr.sql
new file mode 100644
index 0000000000..a3131203dc
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_order_exists_corr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select x,y
+from (values (1,1),(2,5),(3,4)) a(x,y)
+order by exists (select * from (values (2)) b(z) where z <> x),y \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_order_expr_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_order_expr_corr.sql
new file mode 100644
index 0000000000..d4a5393a40
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_order_expr_corr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select -x as x
+from (values (1,1),(2,5),(3,4)) a(x,y)
+order by (select x) \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_order_in_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_order_in_corr.sql
new file mode 100644
index 0000000000..edd6898302
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_order_in_corr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select x,y
+from (values (1,1),(2,5),(3,4)) a(x,y)
+order by 2 not in (select x),y \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_projection_all_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_projection_all_corr.sql
new file mode 100644
index 0000000000..eb75d03293
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_projection_all_corr.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 = all (select 2 where 1 = x) from (values (1,2),(2,3)) a(x,y); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_projection_any_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_projection_any_corr.sql
new file mode 100644
index 0000000000..ba4e193dd9
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_projection_any_corr.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 = any (select 1 where 1 = x) from (values (1,2),(2,3)) a(x,y); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_projection_array.sql b/yql/essentials/tests/sql/suites/pg/sublink_projection_array.sql
new file mode 100644
index 0000000000..f073ab0d1e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_projection_array.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select array(select z from (values (1),(2)) a(z));
+select array(select z from (values (array[1,2]),(array[3,4])) a(z));
+
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_projection_array_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_projection_array_corr.sql
new file mode 100644
index 0000000000..1a98ab394a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_projection_array_corr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select y,array(select x+u from (values (10),(20)) c(u)) from (values (1,2),(2,3)) a(x,y) order by y;
+select y,array(select array[x+u,x+u+1] from (values (10),(20)) c(u)) from (values (1,2),(2,3)) a(x,y) order by y;
+
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_projection_exists_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_projection_exists_corr.sql
new file mode 100644
index 0000000000..8135221621
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_projection_exists_corr.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select exists (select 1 where 1 = x) from (values (1,2),(2,3)) a(x,y); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_projection_expr_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_projection_expr_corr.sql
new file mode 100644
index 0000000000..73b286eeeb
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_projection_expr_corr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select (select x) as z from (values (1,2),(2,3)) a(x,y) order by z;
+select (select x limit 0) as z from (values (1,2),(2,3)) a(x,y) order by z;
+
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_projection_in_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_projection_in_corr.sql
new file mode 100644
index 0000000000..fd042d4b79
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_projection_in_corr.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 in (select 1 where 1 = x) from (values (1,2),(2,3)) a(x,y); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_projection_uncorrelated.sql b/yql/essentials/tests/sql/suites/pg/sublink_projection_uncorrelated.sql
new file mode 100644
index 0000000000..22d3fc00b9
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_projection_uncorrelated.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select 1 as one, (select 2) as two;
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_where_all.sql b/yql/essentials/tests/sql/suites/pg/sublink_where_all.sql
new file mode 100644
index 0000000000..c810321284
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_where_all.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select * from (select 10 as x) a where x > all (values (1),(2));
+select * from (select 2 as x) a where x > all (values (1),(2));
+select * from (select 1 as x) a where x > all (select 1 limit 0);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_where_all_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_where_all_corr.sql
new file mode 100644
index 0000000000..cc7c97a396
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_where_all_corr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select * from (values (1,2),(2,3)) a(x,y) where 1 = all (select 1 where x = 1);
+select * from (values (1,2),(2,3)) a(x,y) where 1 = all (select 1 where x = 10);
+select * from (values (1,2),(2,3)) a(x,y) where 1 = all (select 2 where x = 1);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_where_any.sql b/yql/essentials/tests/sql/suites/pg/sublink_where_any.sql
new file mode 100644
index 0000000000..712eda94bd
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_where_any.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select * from (select 10 as x) a where x > any (values (1),(2));
+select * from (select 2 as x) a where x > any (values (1),(2));
+select * from (select 1 as x) a where x > any (select 1 limit 0);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_where_any_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_where_any_corr.sql
new file mode 100644
index 0000000000..806901aaab
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_where_any_corr.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (values (1,2),(2,3)) a(x,y) where 1 = any (select 1 where x = 1);
+select * from (values (1,2),(2,3)) a(x,y) where 1 = any (select 1 where x = 10);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_where_exists.sql b/yql/essentials/tests/sql/suites/pg/sublink_where_exists.sql
new file mode 100644
index 0000000000..14ad41b684
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_where_exists.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (select 1 as x) a where exists (select 1,2);
+select * from (select 1 as x) a where exists (select 1,2 limit 0);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_where_exists_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_where_exists_corr.sql
new file mode 100644
index 0000000000..07089c410a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_where_exists_corr.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select * from (values (1,2),(2,3)) a(x,y) where exists (select 1 where x=1);
+select * from (values (1,2),(2,3)) a(x,y) where exists (select 1 where x=10);
+
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_where_expr.sql b/yql/essentials/tests/sql/suites/pg/sublink_where_expr.sql
new file mode 100644
index 0000000000..fc3872a343
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_where_expr.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select * from (select 1 as x) a where x = (select 1);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_where_expr_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_where_expr_corr.sql
new file mode 100644
index 0000000000..8b30bc0b40
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_where_expr_corr.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (values (1,2),(2,3)) a(x,y) where 1 = (select 1 where x = 10);
+select * from (values (1,2),(2,3)) a(x,y) where 1 = (select 1 where x = 2);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_where_in.sql b/yql/essentials/tests/sql/suites/pg/sublink_where_in.sql
new file mode 100644
index 0000000000..6fdb415b77
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_where_in.sql
@@ -0,0 +1,4 @@
+--!syntax_pg
+select * from (select 10 as x) a where x in (values (1),(2));
+select * from (select 2 as x) a where x in (values (1),(2));
+select * from (select 1 as x) a where x in (select 1 limit 0);
diff --git a/yql/essentials/tests/sql/suites/pg/sublink_where_in_corr.sql b/yql/essentials/tests/sql/suites/pg/sublink_where_in_corr.sql
new file mode 100644
index 0000000000..70cb650ed2
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/sublink_where_in_corr.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select * from (values (1,2),(2,3)) a(x,y) where 1 in (select 1 where x = 1);
+select * from (values (1,2),(2,3)) a(x,y) where 1 in (select 1 where x = 10);
diff --git a/yql/essentials/tests/sql/suites/pg/table_func.sql b/yql/essentials/tests/sql/suites/pg/table_func.sql
new file mode 100644
index 0000000000..3d481c9cf8
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/table_func.sql
@@ -0,0 +1,15 @@
+--!syntax_pg
+select count(*) from plato.concat('Input','Input');
+select count(*) from plato.concat_view('Input','raw','Input','raw');
+select count(*) from plato.range('');
+select count(*) from plato.range('','A');
+select count(*) from plato.range('','A','Z');
+select count(*) from plato.range('','A','Z','');
+select count(*) from plato.range('','A','Z','','raw');
+select count(*) from plato.regexp('','Inpu.?');
+select count(*) from plato.regexp('','Inpu.?','');
+select count(*) from plato.regexp('','Inpu.?','','raw');
+select count(*) from plato.like('','Inpu%');
+select count(*) from plato.like('','Inpu%','');
+select count(*) from plato.like('','Inpu%','','raw');
+
diff --git a/yql/essentials/tests/sql/suites/pg/type_aliases.sql b/yql/essentials/tests/sql/suites/pg/type_aliases.sql
new file mode 100644
index 0000000000..70bd0331a2
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/type_aliases.sql
@@ -0,0 +1,3 @@
+select
+ pgboolean("true"),pginteger("123"),pgsmallint("123"),pgbigint("123"),pgreal("0.5"),
+ pgdouble_precision("0.5"),pgcharacter("foo"),pgtime_without_time_zone("12:00"),pgcharacter_varying("bar");
diff --git a/yql/essentials/tests/sql/suites/pg/unknown.sql b/yql/essentials/tests/sql/suites/pg/unknown.sql
new file mode 100644
index 0000000000..c03a21a4fd
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/unknown.sql
@@ -0,0 +1,2 @@
+--!syntax_pg
+select ''::unknown, ''::unknown::text
diff --git a/yql/essentials/tests/sql/suites/pg/uuid_from_pg.sql b/yql/essentials/tests/sql/suites/pg/uuid_from_pg.sql
new file mode 100644
index 0000000000..2bf8aeb5f5
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/uuid_from_pg.sql
@@ -0,0 +1,2 @@
+select
+ FromPg(pguuid('12345678-9abc-def0-1234-567890123456'))
diff --git a/yql/essentials/tests/sql/suites/pg/values.sql b/yql/essentials/tests/sql/suites/pg/values.sql
new file mode 100644
index 0000000000..25758fbfb7
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/values.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+values (1,2),(2,3);
+values ('a')
diff --git a/yql/essentials/tests/sql/suites/pg/variadic.sql b/yql/essentials/tests/sql/suites/pg/variadic.sql
new file mode 100644
index 0000000000..0136cb6804
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/variadic.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select concat('a',1,null), concat_ws(',','a',1,null)
+
diff --git a/yql/essentials/tests/sql/suites/pg/variadic_array_arg.sql b/yql/essentials/tests/sql/suites/pg/variadic_array_arg.sql
new file mode 100644
index 0000000000..a2a13f8b98
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/variadic_array_arg.sql
@@ -0,0 +1,3 @@
+--!syntax_pg
+select json_extract_path('{"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}', 'f4', 'f6')
+
diff --git a/yql/essentials/tests/sql/suites/pg/wide_sort.cfg b/yql/essentials/tests/sql/suites/pg/wide_sort.cfg
new file mode 100644
index 0000000000..72b51dc777
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/wide_sort.cfg
@@ -0,0 +1 @@
+in Input input_pg.txt
diff --git a/yql/essentials/tests/sql/suites/pg/wide_sort.sql b/yql/essentials/tests/sql/suites/pg/wide_sort.sql
new file mode 100644
index 0000000000..8d5fcffce2
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/wide_sort.sql
@@ -0,0 +1,5 @@
+USE plato;
+SELECT
+ *
+FROM Input
+ORDER BY a,b desc,c desc
diff --git a/yql/essentials/tests/sql/suites/pg/wide_top_sort.cfg b/yql/essentials/tests/sql/suites/pg/wide_top_sort.cfg
new file mode 100644
index 0000000000..72b51dc777
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/wide_top_sort.cfg
@@ -0,0 +1 @@
+in Input input_pg.txt
diff --git a/yql/essentials/tests/sql/suites/pg/wide_top_sort.sql b/yql/essentials/tests/sql/suites/pg/wide_top_sort.sql
new file mode 100644
index 0000000000..0eabce49df
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/wide_top_sort.sql
@@ -0,0 +1,5 @@
+USE plato;
+SELECT
+ *
+FROM Input
+ORDER BY a,b desc,c desc LIMIT 3
diff --git a/yql/essentials/tests/sql/suites/pg/with.sql b/yql/essentials/tests/sql/suites/pg/with.sql
new file mode 100644
index 0000000000..f37e69b95e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/with.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+with foo(x) as (
+ select 1
+), bar as (select 2 as y from foo)
+select x,b.y,z,a.y as y2 from foo,bar b,(
+with foo as (select 3 as z)
+select * from foo, bar) a
diff --git a/yql/essentials/tests/sql/suites/pg/with_rec_all.sql b/yql/essentials/tests/sql/suites/pg/with_rec_all.sql
new file mode 100644
index 0000000000..dd657be29a
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/with_rec_all.sql
@@ -0,0 +1,8 @@
+--!syntax_pg
+WITH RECURSIVE t(n) AS (
+ SELECT 1
+ UNION ALL
+ SELECT n+1 FROM t WHERE n < 5
+)
+SELECT * FROM t
+
diff --git a/yql/essentials/tests/sql/suites/pg/with_rec_all_empty.sql b/yql/essentials/tests/sql/suites/pg/with_rec_all_empty.sql
new file mode 100644
index 0000000000..84deddc383
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/with_rec_all_empty.sql
@@ -0,0 +1,9 @@
+--!syntax_pg
+WITH RECURSIVE t(n) AS (
+ SELECT * FROM (SELECT 1 LIMIT 0) a
+ UNION ALL
+ SELECT n+1 FROM t WHERE n < 5
+)
+SELECT * FROM t
+
+
diff --git a/yql/essentials/tests/sql/suites/pg/with_rec_distinct.sql b/yql/essentials/tests/sql/suites/pg/with_rec_distinct.sql
new file mode 100644
index 0000000000..fc2d879ac1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/with_rec_distinct.sql
@@ -0,0 +1,7 @@
+--!syntax_pg
+WITH RECURSIVE t(n) AS (
+ SELECT 1
+ UNION
+ SELECT 1 FROM t
+)
+SELECT * FROM t
diff --git a/yql/essentials/tests/sql/suites/pg/with_rec_trivial.sql b/yql/essentials/tests/sql/suites/pg/with_rec_trivial.sql
new file mode 100644
index 0000000000..8d53e48309
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/pg/with_rec_trivial.sql
@@ -0,0 +1,5 @@
+--!syntax_pg
+WITH RECURSIVE t(n) AS (
+ select 1
+)
+SELECT n FROM t;