├── .editorconfig ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── example ├── format │ └── format.go └── walk │ └── walk.go ├── go.mod ├── go.sum └── pkg ├── sql ├── lex │ ├── all_keywords.go │ ├── encode.go │ ├── encode_test.go.bak │ ├── experimental_keywords.go │ ├── keywords.go │ ├── normalize.go │ ├── predicates.go │ ├── reserved_keywords.go │ └── tokens.go ├── parser │ ├── README.md │ ├── base.go │ ├── gen │ │ ├── sql-gen.y │ │ ├── sql.go.tmp │ │ └── y.output │ ├── help.awk │ ├── help.go │ ├── help_gen_test.sh │ ├── help_messages.go │ ├── help_test.go.bak │ ├── helpmap_test.go │ ├── helpmap_test.go.bak │ ├── lexer.go │ ├── lexer_test.go.bak │ ├── parse.go │ ├── parse_internal_test.go │ ├── parse_test.go │ ├── replace_help_rules.awk │ ├── reserved_keywords.awk │ ├── scan.go │ ├── scan_test.go.bak │ ├── show_syntax.go │ ├── sql.go │ ├── sql.y │ └── unreserved_keywords.awk ├── pgwire │ ├── pgcode │ │ ├── codes.go │ │ ├── doc.go │ │ ├── errcodes.txt │ │ └── generate.sh │ └── pgerror │ │ ├── errors.go │ │ ├── errors.pb.go │ │ ├── errors.proto │ │ ├── errors_test.go.bak │ │ ├── flatten.go │ │ ├── flatten_test.go.bak │ │ ├── internal_errors.go │ │ ├── internal_errors_test.go.bak │ │ ├── pgcode.go │ │ ├── pgcode_test.go.bak │ │ ├── with_candidate_code.go │ │ ├── wrap.go │ │ └── wrap_test.go.bak ├── privilege │ ├── kind_string.go │ ├── privilege.go │ └── privilege_test.go.bak ├── sem │ └── tree │ │ ├── aggregate_funcs.go │ │ ├── alter_index.go │ │ ├── alter_sequence.go │ │ ├── alter_table.go │ │ ├── annotation.go │ │ ├── as_of.go │ │ ├── backup.go │ │ ├── changefeed.go │ │ ├── col_name.go │ │ ├── col_types_test.go.bak │ │ ├── collatedstring_test.go.bak │ │ ├── comment_on_column.go │ │ ├── comment_on_database.go │ │ ├── comment_on_index.go │ │ ├── comment_on_table.go │ │ ├── constant.go │ │ ├── constant_eval.go │ │ ├── constant_eval_test.go.bak │ │ ├── constant_test.go.bak │ │ ├── copy.go │ │ ├── create.go │ │ ├── datum.go │ │ ├── decimal.go │ │ ├── delete.go │ │ ├── discard.go │ │ ├── drop.go │ │ ├── eval.go │ │ ├── explain.go │ │ ├── export.go │ │ ├── expr.go │ │ ├── expr_test.go.bak │ │ ├── format.go │ │ ├── format_test.go.bak │ │ ├── function_definition.go │ │ ├── function_name.go │ │ ├── function_name_test.go.bak │ │ ├── fuzz.go │ │ ├── grant.go │ │ ├── hide_constants.go │ │ ├── import.go │ │ ├── indexed_vars.go │ │ ├── indexed_vars_test.go.bak │ │ ├── insert.go │ │ ├── interval.go │ │ ├── interval_test.go.bak │ │ ├── main_test.go.bak │ │ ├── name_part.go │ │ ├── name_part_test.go.bak │ │ ├── name_resolution.go │ │ ├── name_resolution_test.go.bak │ │ ├── nightly_pretty_test.go.bak │ │ ├── normalize.go │ │ ├── normalize_test.go │ │ ├── operators.go │ │ ├── overload.go │ │ ├── overload_test.go.bak │ │ ├── parse_array.go │ │ ├── parse_array_test.go.bak │ │ ├── parse_string.go │ │ ├── pgwire_encode.go │ │ ├── placeholders.go │ │ ├── placeholders_test.go.bak │ │ ├── prepare.go │ │ ├── pretty.go │ │ ├── pretty_test.go.bak │ │ ├── rename.go │ │ ├── returning.go │ │ ├── revoke.go │ │ ├── run_control.go │ │ ├── scrub.go │ │ ├── select.go │ │ ├── set.go │ │ ├── show.go │ │ ├── split.go │ │ ├── statementtype_string.go │ │ ├── stmt.go │ │ ├── table_name.go │ │ ├── table_name_test.go.bak │ │ ├── table_pattern.go │ │ ├── table_ref.go │ │ ├── testdata │ │ ├── eval │ │ │ ├── annotate │ │ │ ├── any_some_all │ │ │ ├── arithmetic_operators │ │ │ ├── array │ │ │ ├── at_time_zone │ │ │ ├── between │ │ │ ├── bit_array │ │ │ ├── bitshift │ │ │ ├── bitwise_operators │ │ │ ├── boolean │ │ │ ├── builtins │ │ │ ├── case │ │ │ ├── cast │ │ │ ├── comparison │ │ │ ├── concat │ │ │ ├── conditional │ │ │ ├── convert │ │ │ ├── distinct │ │ │ ├── extract │ │ │ ├── float_decimal_div │ │ │ ├── func │ │ │ ├── grouping │ │ │ ├── hex │ │ │ ├── in │ │ │ ├── inet │ │ │ ├── infinity │ │ │ ├── int_decimal_arith │ │ │ ├── int_min │ │ │ ├── interval │ │ │ ├── is │ │ │ ├── like │ │ │ ├── nan │ │ │ ├── oid │ │ │ ├── ones_complement │ │ │ ├── overflow │ │ │ ├── regex │ │ │ ├── row │ │ │ ├── similar │ │ │ └── unary │ │ └── pretty │ │ │ ├── 1.align-deindent.golden │ │ │ ├── 1.align-deindent.golden.short │ │ │ ├── 1.align-only.golden │ │ │ ├── 1.align-only.golden.short │ │ │ ├── 1.ref.golden │ │ │ ├── 1.ref.golden.short │ │ │ ├── 1.sql │ │ │ ├── 10.align-deindent.golden │ │ │ ├── 10.align-deindent.golden.short │ │ │ ├── 10.align-only.golden │ │ │ ├── 10.align-only.golden.short │ │ │ ├── 10.ref.golden │ │ │ ├── 10.ref.golden.short │ │ │ ├── 10.sql │ │ │ ├── 11.align-deindent.golden │ │ │ ├── 11.align-deindent.golden.short │ │ │ ├── 11.align-only.golden │ │ │ ├── 11.align-only.golden.short │ │ │ ├── 11.ref.golden │ │ │ ├── 11.ref.golden.short │ │ │ ├── 11.sql │ │ │ ├── 12.align-deindent.golden │ │ │ ├── 12.align-deindent.golden.short │ │ │ ├── 12.align-only.golden │ │ │ ├── 12.align-only.golden.short │ │ │ ├── 12.ref.golden │ │ │ ├── 12.ref.golden.short │ │ │ ├── 12.sql │ │ │ ├── 13.align-deindent.golden │ │ │ ├── 13.align-deindent.golden.short │ │ │ ├── 13.align-only.golden │ │ │ ├── 13.align-only.golden.short │ │ │ ├── 13.ref.golden │ │ │ ├── 13.ref.golden.short │ │ │ ├── 13.sql │ │ │ ├── 14.align-deindent.golden │ │ │ ├── 14.align-deindent.golden.short │ │ │ ├── 14.align-only.golden │ │ │ ├── 14.align-only.golden.short │ │ │ ├── 14.ref.golden │ │ │ ├── 14.ref.golden.short │ │ │ ├── 14.sql │ │ │ ├── 15.align-deindent.golden │ │ │ ├── 15.align-deindent.golden.short │ │ │ ├── 15.align-only.golden │ │ │ ├── 15.align-only.golden.short │ │ │ ├── 15.ref.golden │ │ │ ├── 15.ref.golden.short │ │ │ ├── 15.sql │ │ │ ├── 16.align-deindent.golden │ │ │ ├── 16.align-deindent.golden.short │ │ │ ├── 16.align-only.golden │ │ │ ├── 16.align-only.golden.short │ │ │ ├── 16.ref.golden │ │ │ ├── 16.ref.golden.short │ │ │ ├── 16.sql │ │ │ ├── 17.align-deindent.golden │ │ │ ├── 17.align-deindent.golden.short │ │ │ ├── 17.align-only.golden │ │ │ ├── 17.align-only.golden.short │ │ │ ├── 17.ref.golden │ │ │ ├── 17.ref.golden.short │ │ │ ├── 17.sql │ │ │ ├── 18.align-deindent.golden │ │ │ ├── 18.align-deindent.golden.short │ │ │ ├── 18.align-only.golden │ │ │ ├── 18.align-only.golden.short │ │ │ ├── 18.ref.golden │ │ │ ├── 18.ref.golden.short │ │ │ ├── 18.sql │ │ │ ├── 19.align-deindent.golden │ │ │ ├── 19.align-deindent.golden.short │ │ │ ├── 19.align-only.golden │ │ │ ├── 19.align-only.golden.short │ │ │ ├── 19.ref.golden │ │ │ ├── 19.ref.golden.short │ │ │ ├── 19.sql │ │ │ ├── 2.align-deindent.golden │ │ │ ├── 2.align-deindent.golden.short │ │ │ ├── 2.align-only.golden │ │ │ ├── 2.align-only.golden.short │ │ │ ├── 2.ref.golden │ │ │ ├── 2.ref.golden.short │ │ │ ├── 2.sql │ │ │ ├── 20.align-deindent.golden │ │ │ ├── 20.align-deindent.golden.short │ │ │ ├── 20.align-only.golden │ │ │ ├── 20.align-only.golden.short │ │ │ ├── 20.ref.golden │ │ │ ├── 20.ref.golden.short │ │ │ ├── 20.sql │ │ │ ├── 21.align-deindent.golden │ │ │ ├── 21.align-deindent.golden.short │ │ │ ├── 21.align-only.golden │ │ │ ├── 21.align-only.golden.short │ │ │ ├── 21.ref.golden │ │ │ ├── 21.ref.golden.short │ │ │ ├── 21.sql │ │ │ ├── 22.align-deindent.golden.short │ │ │ ├── 22.align-only.golden.short │ │ │ ├── 22.ref.golden.short │ │ │ ├── 22.sql │ │ │ ├── 3.align-deindent.golden │ │ │ ├── 3.align-deindent.golden.short │ │ │ ├── 3.align-only.golden │ │ │ ├── 3.align-only.golden.short │ │ │ ├── 3.ref.golden │ │ │ ├── 3.ref.golden.short │ │ │ ├── 3.sql │ │ │ ├── 4.align-deindent.golden │ │ │ ├── 4.align-deindent.golden.short │ │ │ ├── 4.align-only.golden │ │ │ ├── 4.align-only.golden.short │ │ │ ├── 4.ref.golden │ │ │ ├── 4.ref.golden.short │ │ │ ├── 4.sql │ │ │ ├── 5.align-deindent.golden │ │ │ ├── 5.align-deindent.golden.short │ │ │ ├── 5.align-only.golden │ │ │ ├── 5.align-only.golden.short │ │ │ ├── 5.ref.golden │ │ │ ├── 5.ref.golden.short │ │ │ ├── 5.sql │ │ │ ├── 6.align-deindent.golden │ │ │ ├── 6.align-deindent.golden.short │ │ │ ├── 6.align-only.golden │ │ │ ├── 6.align-only.golden.short │ │ │ ├── 6.ref.golden │ │ │ ├── 6.ref.golden.short │ │ │ ├── 6.sql │ │ │ ├── 7.align-deindent.golden │ │ │ ├── 7.align-deindent.golden.short │ │ │ ├── 7.align-only.golden │ │ │ ├── 7.align-only.golden.short │ │ │ ├── 7.ref.golden │ │ │ ├── 7.ref.golden.short │ │ │ ├── 7.sql │ │ │ ├── 8.align-deindent.golden │ │ │ ├── 8.align-deindent.golden.short │ │ │ ├── 8.align-only.golden │ │ │ ├── 8.align-only.golden.short │ │ │ ├── 8.ref.golden │ │ │ ├── 8.ref.golden.short │ │ │ ├── 8.sql │ │ │ ├── 9.align-deindent.golden │ │ │ ├── 9.align-deindent.golden.short │ │ │ ├── 9.align-only.golden │ │ │ ├── 9.align-only.golden.short │ │ │ ├── 9.ref.golden │ │ │ ├── 9.ref.golden.short │ │ │ ├── 9.sql │ │ │ ├── andor.align-deindent.golden │ │ │ ├── andor.align-deindent.golden.short │ │ │ ├── andor.align-only.golden │ │ │ ├── andor.align-only.golden.short │ │ │ ├── andor.ref.golden │ │ │ ├── andor.ref.golden.short │ │ │ ├── andor.sql │ │ │ ├── backup.align-deindent.golden │ │ │ ├── backup.align-deindent.golden.short │ │ │ ├── backup.align-only.golden │ │ │ ├── backup.align-only.golden.short │ │ │ ├── backup.ref.golden │ │ │ ├── backup.ref.golden.short │ │ │ ├── backup.sql │ │ │ ├── case.align-deindent.golden │ │ │ ├── case.align-deindent.golden.short │ │ │ ├── case.align-only.golden │ │ │ ├── case.align-only.golden.short │ │ │ ├── case.ref.golden │ │ │ ├── case.ref.golden.short │ │ │ ├── case.sql │ │ │ ├── comparison.align-deindent.golden │ │ │ ├── comparison.align-deindent.golden.short │ │ │ ├── comparison.align-only.golden │ │ │ ├── comparison.align-only.golden.short │ │ │ ├── comparison.ref.golden │ │ │ ├── comparison.ref.golden.short │ │ │ ├── comparison.sql │ │ │ ├── create_as.align-deindent.golden │ │ │ ├── create_as.align-deindent.golden.short │ │ │ ├── create_as.align-only.golden │ │ │ ├── create_as.align-only.golden.short │ │ │ ├── create_as.ref.golden │ │ │ ├── create_as.ref.golden.short │ │ │ ├── create_as.sql │ │ │ ├── create_index_partition.align-deindent.golden │ │ │ ├── create_index_partition.align-deindent.golden.short │ │ │ ├── create_index_partition.align-only.golden │ │ │ ├── create_index_partition.align-only.golden.short │ │ │ ├── create_index_partition.ref.golden │ │ │ ├── create_index_partition.ref.golden.short │ │ │ ├── create_index_partition.sql │ │ │ ├── create_interleaved_drop.align-deindent.golden │ │ │ ├── create_interleaved_drop.align-deindent.golden.short │ │ │ ├── create_interleaved_drop.align-only.golden │ │ │ ├── create_interleaved_drop.align-only.golden.short │ │ │ ├── create_interleaved_drop.ref.golden │ │ │ ├── create_interleaved_drop.ref.golden.short │ │ │ ├── create_interleaved_drop.sql │ │ │ ├── create_partition_list.align-deindent.golden │ │ │ ├── create_partition_list.align-deindent.golden.short │ │ │ ├── create_partition_list.align-only.golden │ │ │ ├── create_partition_list.align-only.golden.short │ │ │ ├── create_partition_list.ref.golden │ │ │ ├── create_partition_list.ref.golden.short │ │ │ ├── create_partition_list.sql │ │ │ ├── create_partition_range.align-deindent.golden │ │ │ ├── create_partition_range.align-deindent.golden.short │ │ │ ├── create_partition_range.align-only.golden │ │ │ ├── create_partition_range.align-only.golden.short │ │ │ ├── create_partition_range.ref.golden │ │ │ ├── create_partition_range.ref.golden.short │ │ │ ├── create_partition_range.sql │ │ │ ├── create_subpartition.align-deindent.golden │ │ │ ├── create_subpartition.align-deindent.golden.short │ │ │ ├── create_subpartition.align-only.golden │ │ │ ├── create_subpartition.align-only.golden.short │ │ │ ├── create_subpartition.ref.golden │ │ │ ├── create_subpartition.ref.golden.short │ │ │ ├── create_subpartition.sql │ │ │ ├── create_table.align-deindent.golden │ │ │ ├── create_table.align-deindent.golden.short │ │ │ ├── create_table.align-only.golden │ │ │ ├── create_table.align-only.golden.short │ │ │ ├── create_table.ref.golden │ │ │ ├── create_table.ref.golden.short │ │ │ ├── create_table.sql │ │ │ ├── create_view.align-deindent.golden │ │ │ ├── create_view.align-deindent.golden.short │ │ │ ├── create_view.align-only.golden │ │ │ ├── create_view.align-only.golden.short │ │ │ ├── create_view.ref.golden │ │ │ ├── create_view.ref.golden.short │ │ │ ├── create_view.sql │ │ │ ├── explain.align-deindent.golden │ │ │ ├── explain.align-deindent.golden.short │ │ │ ├── explain.align-only.golden │ │ │ ├── explain.align-only.golden.short │ │ │ ├── explain.ref.golden │ │ │ ├── explain.ref.golden.short │ │ │ ├── explain.sql │ │ │ ├── explain_analyze.align-deindent.golden │ │ │ ├── explain_analyze.align-deindent.golden.short │ │ │ ├── explain_analyze.align-only.golden │ │ │ ├── explain_analyze.align-only.golden.short │ │ │ ├── explain_analyze.ref.golden │ │ │ ├── explain_analyze.ref.golden.short │ │ │ ├── explain_analyze.sql │ │ │ ├── export.align-deindent.golden │ │ │ ├── export.align-deindent.golden.short │ │ │ ├── export.align-only.golden │ │ │ ├── export.align-only.golden.short │ │ │ ├── export.ref.golden │ │ │ ├── export.ref.golden.short │ │ │ ├── export.sql │ │ │ ├── functions.align-deindent.golden │ │ │ ├── functions.align-deindent.golden.short │ │ │ ├── functions.align-only.golden │ │ │ ├── functions.align-only.golden.short │ │ │ ├── functions.ref.golden │ │ │ ├── functions.ref.golden.short │ │ │ ├── functions.sql │ │ │ ├── import1.align-deindent.golden │ │ │ ├── import1.align-deindent.golden.short │ │ │ ├── import1.align-only.golden │ │ │ ├── import1.align-only.golden.short │ │ │ ├── import1.ref.golden │ │ │ ├── import1.ref.golden.short │ │ │ ├── import1.sql │ │ │ ├── import2.align-deindent.golden │ │ │ ├── import2.align-deindent.golden.short │ │ │ ├── import2.align-only.golden │ │ │ ├── import2.align-only.golden.short │ │ │ ├── import2.ref.golden │ │ │ ├── import2.ref.golden.short │ │ │ ├── import2.sql │ │ │ ├── import3.align-deindent.golden │ │ │ ├── import3.align-deindent.golden.short │ │ │ ├── import3.align-only.golden │ │ │ ├── import3.align-only.golden.short │ │ │ ├── import3.ref.golden │ │ │ ├── import3.ref.golden.short │ │ │ ├── import3.sql │ │ │ ├── import4.align-deindent.golden │ │ │ ├── import4.align-deindent.golden.short │ │ │ ├── import4.align-only.golden │ │ │ ├── import4.align-only.golden.short │ │ │ ├── import4.ref.golden │ │ │ ├── import4.ref.golden.short │ │ │ ├── import4.sql │ │ │ ├── join1.align-deindent.golden │ │ │ ├── join1.align-deindent.golden.short │ │ │ ├── join1.align-only.golden │ │ │ ├── join1.align-only.golden.short │ │ │ ├── join1.ref.golden │ │ │ ├── join1.ref.golden.short │ │ │ ├── join1.sql │ │ │ ├── join2.align-deindent.golden │ │ │ ├── join2.align-deindent.golden.short │ │ │ ├── join2.align-only.golden │ │ │ ├── join2.align-only.golden.short │ │ │ ├── join2.ref.golden │ │ │ ├── join2.ref.golden.short │ │ │ ├── join2.sql │ │ │ ├── join3.align-deindent.golden │ │ │ ├── join3.align-deindent.golden.short │ │ │ ├── join3.align-only.golden │ │ │ ├── join3.align-only.golden.short │ │ │ ├── join3.ref.golden │ │ │ ├── join3.ref.golden.short │ │ │ ├── join3.sql │ │ │ ├── join4.align-deindent.golden │ │ │ ├── join4.align-deindent.golden.short │ │ │ ├── join4.align-only.golden │ │ │ ├── join4.align-only.golden.short │ │ │ ├── join4.ref.golden │ │ │ ├── join4.ref.golden.short │ │ │ ├── join4.sql │ │ │ ├── join5.align-deindent.golden │ │ │ ├── join5.align-deindent.golden.short │ │ │ ├── join5.align-only.golden │ │ │ ├── join5.align-only.golden.short │ │ │ ├── join5.ref.golden │ │ │ ├── join5.ref.golden.short │ │ │ ├── join5.sql │ │ │ ├── json.align-deindent.golden │ │ │ ├── json.align-deindent.golden.short │ │ │ ├── json.align-only.golden │ │ │ ├── json.align-only.golden.short │ │ │ ├── json.ref.golden │ │ │ ├── json.ref.golden.short │ │ │ ├── json.sql │ │ │ ├── precedence.align-deindent.golden │ │ │ ├── precedence.align-deindent.golden.short │ │ │ ├── precedence.align-only.golden │ │ │ ├── precedence.align-only.golden.short │ │ │ ├── precedence.ref.golden │ │ │ ├── precedence.ref.golden.short │ │ │ ├── precedence.sql │ │ │ ├── restore.align-deindent.golden │ │ │ ├── restore.align-deindent.golden.short │ │ │ ├── restore.align-only.golden │ │ │ ├── restore.align-only.golden.short │ │ │ ├── restore.ref.golden │ │ │ ├── restore.ref.golden.short │ │ │ ├── restore.sql │ │ │ ├── srfs.align-deindent.golden │ │ │ ├── srfs.align-deindent.golden.short │ │ │ ├── srfs.align-only.golden │ │ │ ├── srfs.align-only.golden.short │ │ │ ├── srfs.ref.golden │ │ │ ├── srfs.ref.golden.short │ │ │ ├── srfs.sql │ │ │ ├── union_all.align-deindent.golden │ │ │ ├── union_all.align-deindent.golden.short │ │ │ ├── union_all.align-only.golden │ │ │ ├── union_all.align-only.golden.short │ │ │ ├── union_all.ref.golden │ │ │ ├── union_all.ref.golden.short │ │ │ ├── union_all.sql │ │ │ ├── window.align-deindent.golden │ │ │ ├── window.align-deindent.golden.short │ │ │ ├── window.align-only.golden │ │ │ ├── window.align-only.golden.short │ │ │ ├── window.ref.golden │ │ │ ├── window.ref.golden.short │ │ │ └── window.sql │ │ ├── testutils.go │ │ ├── time.go │ │ ├── time_test.go.bak │ │ ├── timeconv_test.go.bak │ │ ├── truncate.go │ │ ├── txn.go │ │ ├── type_check.go │ │ ├── type_check_internal_test.go.bak │ │ ├── type_check_test.go.bak │ │ ├── union.go │ │ ├── update.go │ │ ├── values.go │ │ ├── var_name.go │ │ ├── walk.go │ │ ├── window_funcs.go │ │ ├── window_funcs_test.go.bak │ │ ├── window_funcs_util.go │ │ ├── with.go │ │ └── zone.go ├── sessiondata │ ├── search_path.go │ ├── search_path_test.go.bak │ ├── sequence_state.go │ └── session_data.go └── types │ ├── oid.go │ ├── types.go │ ├── types.pb.go │ ├── types.proto │ └── types_test.go.bak ├── testutils ├── error.go └── sqlutils │ └── pretty.go ├── util ├── arith │ └── arith.go ├── bitarray │ ├── bitarray.go │ └── bitarray_test.go.bak ├── caller │ ├── resolver.go │ └── resolver_test.go.bak ├── duration │ ├── duration.go │ └── duration_test.go.bak ├── encoding │ ├── complement_fast.go │ ├── complement_safe.go │ ├── csv │ │ ├── example_test.go.bak │ │ ├── reader.go │ │ ├── reader_test.go.bak │ │ ├── writer.go │ │ └── writer_test.go.bak │ ├── decimal.go │ ├── decimal_test.go.bak │ ├── encoding.go │ ├── encoding_test.go.bak │ ├── float.go │ ├── float_test.go.bak │ ├── main_test.go.bak │ ├── printer_test.go.bak │ └── type_string.go ├── envutil │ ├── env.go │ └── env_test.go.bak ├── errorutil │ ├── catch.go │ ├── error.go │ ├── error_test.go.bak │ └── unimplemented │ │ ├── unimplemented.go │ │ └── unimplemented_test.go.bak ├── hlc │ ├── hlc.go │ ├── hlc_clock_device_linux.go │ ├── hlc_clock_device_stub.go │ ├── hlc_test.go.bak │ ├── legacy_timestamp.pb.go │ ├── legacy_timestamp.proto │ ├── timestamp.go │ ├── timestamp.pb.go │ ├── timestamp.proto │ └── timestamp_test.go.bak ├── humanizeutil │ ├── humanize.go │ └── humanize_test.go.bak ├── ipaddr │ ├── ipaddr.go │ └── ipaddr_test.go.bak ├── json │ ├── contains.go │ ├── contains_testers.go │ ├── encode.go │ ├── encode_test.go.bak │ ├── encoded.go │ ├── fuzz.go │ ├── iterator.go │ ├── jentry.go │ ├── json.go │ ├── json_test.go.bak │ ├── random.go │ ├── tables.go │ └── testdata │ │ ├── README │ │ ├── encoded │ │ ├── a.json.bytes │ │ ├── array_arraysWithSpaces.json.bytes │ │ ├── array_empty-string.json.bytes │ │ ├── array_empty.json.bytes │ │ ├── array_ending_with_newline.json.bytes │ │ ├── array_false.json.bytes │ │ ├── array_heterogeneous.json.bytes │ │ ├── array_null.json.bytes │ │ ├── array_with_1_and_newline.json.bytes │ │ ├── array_with_leading_space.json.bytes │ │ ├── array_with_several_null.json.bytes │ │ ├── array_with_trailing_space.json.bytes │ │ ├── number.json.bytes │ │ ├── number_after_space.json.bytes │ │ ├── number_double_close_to_zero.json.bytes │ │ ├── number_int_with_exp.json.bytes │ │ ├── number_minus_zero.json.bytes │ │ ├── number_negative_int.json.bytes │ │ ├── number_negative_one.json.bytes │ │ ├── number_negative_zero.json.bytes │ │ ├── number_real_capital_e.json.bytes │ │ ├── number_real_capital_e_neg_exp.json.bytes │ │ ├── number_real_capital_e_pos_exp.json.bytes │ │ ├── number_real_exponent.json.bytes │ │ ├── number_real_fraction_exponent.json.bytes │ │ ├── number_real_neg_exp.json.bytes │ │ ├── number_real_pos_exponent.json.bytes │ │ ├── number_simple_int.json.bytes │ │ ├── number_simple_real.json.bytes │ │ ├── object.json.bytes │ │ ├── object_basic.json.bytes │ │ ├── object_duplicated_key.json.bytes │ │ ├── object_duplicated_key_and_value.json.bytes │ │ ├── object_empty.json.bytes │ │ ├── object_empty_key.json.bytes │ │ ├── object_escaped_null_in_key.json.bytes │ │ ├── object_extreme_numbers.json.bytes │ │ ├── object_long_strings.json.bytes │ │ ├── object_simple.json.bytes │ │ ├── object_string_unicode.json.bytes │ │ ├── object_with_newlines.json.bytes │ │ ├── string_1_2_3_bytes_UTF-8_sequences.json.bytes │ │ ├── string_accepted_surrogate_pair.json.bytes │ │ ├── string_accepted_surrogate_pairs.json.bytes │ │ ├── string_allowed_escapes.json.bytes │ │ ├── string_and_u_escaped_zero.json.bytes │ │ ├── string_comments.json.bytes │ │ ├── string_double_escape_a.json.bytes │ │ ├── string_double_escape_n.json.bytes │ │ ├── string_doublequotes.json.bytes │ │ ├── string_escaped_control_character.json.bytes │ │ ├── string_escaped_noncharacter.json.bytes │ │ ├── string_in_array.json.bytes │ │ ├── string_in_array_with_leading_space.json.bytes │ │ ├── string_last_surrogates_1_and_2.json.bytes │ │ ├── string_nbsp_uescaped.json.bytes │ │ ├── string_nonCharacterInUTF-8_U+10FFFF.json.bytes │ │ ├── string_nonCharacterInUTF-8_U+1FFFF.json.bytes │ │ ├── string_nonCharacterInUTF-8_U+FFFF.json.bytes │ │ ├── string_null_escape.json.bytes │ │ ├── string_one-byte-utf-8.json.bytes │ │ ├── string_pi.json.bytes │ │ ├── string_simple_ascii.json.bytes │ │ ├── string_space.json.bytes │ │ ├── string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json.bytes │ │ ├── string_three-byte-utf-8.json.bytes │ │ ├── string_two-byte-utf-8.json.bytes │ │ ├── string_u+2028_line_sep.json.bytes │ │ ├── string_u+2029_par_sep.json.bytes │ │ ├── string_uEscape.json.bytes │ │ ├── string_uescaped_newline.json.bytes │ │ ├── string_unescaped_char_delete.json.bytes │ │ ├── string_unicode.json.bytes │ │ ├── string_unicodeEscapedBackslash.json.bytes │ │ ├── string_unicode_2.json.bytes │ │ ├── string_unicode_U+10FFFE_nonchar.json.bytes │ │ ├── string_unicode_U+1FFFE_nonchar.json.bytes │ │ ├── string_unicode_U+200B_ZERO_WIDTH_SPACE.json.bytes │ │ ├── string_unicode_U+2064_invisible_plus.json.bytes │ │ ├── string_unicode_U+FDD0_nonchar.json.bytes │ │ ├── string_unicode_U+FFFE_nonchar.json.bytes │ │ ├── string_unicode_escaped_double_quote.json.bytes │ │ ├── string_utf8.json.bytes │ │ ├── string_with_del_character.json.bytes │ │ ├── structure_lonely_false.json.bytes │ │ ├── structure_lonely_int.json.bytes │ │ ├── structure_lonely_negative_real.json.bytes │ │ ├── structure_lonely_null.json.bytes │ │ ├── structure_lonely_string.json.bytes │ │ ├── structure_lonely_true.json.bytes │ │ ├── structure_string_empty.json.bytes │ │ ├── structure_trailing_newline.json.bytes │ │ ├── structure_true_in_array.json.bytes │ │ └── structure_whitespace_array.json.bytes │ │ └── raw │ │ ├── a.json │ │ ├── array_arraysWithSpaces.json │ │ ├── array_empty-string.json │ │ ├── array_empty.json │ │ ├── array_ending_with_newline.json │ │ ├── array_false.json │ │ ├── array_heterogeneous.json │ │ ├── array_null.json │ │ ├── array_with_1_and_newline.json │ │ ├── array_with_leading_space.json │ │ ├── array_with_several_null.json │ │ ├── array_with_trailing_space.json │ │ ├── number.json │ │ ├── number_after_space.json │ │ ├── number_double_close_to_zero.json │ │ ├── number_int_with_exp.json │ │ ├── number_minus_zero.json │ │ ├── number_negative_int.json │ │ ├── number_negative_one.json │ │ ├── number_negative_zero.json │ │ ├── number_real_capital_e.json │ │ ├── number_real_capital_e_neg_exp.json │ │ ├── number_real_capital_e_pos_exp.json │ │ ├── number_real_exponent.json │ │ ├── number_real_fraction_exponent.json │ │ ├── number_real_neg_exp.json │ │ ├── number_real_pos_exponent.json │ │ ├── number_simple_int.json │ │ ├── number_simple_real.json │ │ ├── object.json │ │ ├── object_basic.json │ │ ├── object_duplicated_key.json │ │ ├── object_duplicated_key_and_value.json │ │ ├── object_empty.json │ │ ├── object_empty_key.json │ │ ├── object_escaped_null_in_key.json │ │ ├── object_extreme_numbers.json │ │ ├── object_long_strings.json │ │ ├── object_simple.json │ │ ├── object_string_unicode.json │ │ ├── object_with_newlines.json │ │ ├── string_1_2_3_bytes_UTF-8_sequences.json │ │ ├── string_accepted_surrogate_pair.json │ │ ├── string_accepted_surrogate_pairs.json │ │ ├── string_allowed_escapes.json │ │ ├── string_and_u_escaped_zero.json │ │ ├── string_comments.json │ │ ├── string_double_escape_a.json │ │ ├── string_double_escape_n.json │ │ ├── string_doublequotes.json │ │ ├── string_escaped_control_character.json │ │ ├── string_escaped_noncharacter.json │ │ ├── string_in_array.json │ │ ├── string_in_array_with_leading_space.json │ │ ├── string_last_surrogates_1_and_2.json │ │ ├── string_nbsp_uescaped.json │ │ ├── string_nonCharacterInUTF-8_U+10FFFF.json │ │ ├── string_nonCharacterInUTF-8_U+1FFFF.json │ │ ├── string_nonCharacterInUTF-8_U+FFFF.json │ │ ├── string_null_escape.json │ │ ├── string_one-byte-utf-8.json │ │ ├── string_pi.json │ │ ├── string_simple_ascii.json │ │ ├── string_space.json │ │ ├── string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json │ │ ├── string_three-byte-utf-8.json │ │ ├── string_two-byte-utf-8.json │ │ ├── string_u+2028_line_sep.json │ │ ├── string_u+2029_par_sep.json │ │ ├── string_uEscape.json │ │ ├── string_uescaped_newline.json │ │ ├── string_unescaped_char_delete.json │ │ ├── string_unicode.json │ │ ├── string_unicodeEscapedBackslash.json │ │ ├── string_unicode_2.json │ │ ├── string_unicode_U+10FFFE_nonchar.json │ │ ├── string_unicode_U+1FFFE_nonchar.json │ │ ├── string_unicode_U+200B_ZERO_WIDTH_SPACE.json │ │ ├── string_unicode_U+2064_invisible_plus.json │ │ ├── string_unicode_U+FDD0_nonchar.json │ │ ├── string_unicode_U+FFFE_nonchar.json │ │ ├── string_unicode_escaped_double_quote.json │ │ ├── string_utf8.json │ │ ├── string_with_del_character.json │ │ ├── structure_lonely_false.json │ │ ├── structure_lonely_int.json │ │ ├── structure_lonely_negative_real.json │ │ ├── structure_lonely_null.json │ │ ├── structure_lonely_string.json │ │ ├── structure_lonely_true.json │ │ ├── structure_string_empty.json │ │ ├── structure_trailing_newline.json │ │ ├── structure_true_in_array.json │ │ └── structure_whitespace_array.json ├── leaktest │ ├── add-leaktest.sh │ ├── check-leaktest.sh │ └── leaktest.go ├── nocopy.go ├── pretty │ ├── document.go │ ├── pretty.go │ ├── pretty_test.go.bak │ └── util.go ├── protoutil │ ├── clone.go │ ├── clone.pb.go │ ├── clone.proto │ ├── clone_test.go.bak │ ├── fuzz_disabled.go │ ├── fuzz_enabled.go │ ├── jsonpb_marshal.go │ ├── marshal.go │ ├── marshaler.go │ ├── randnullability.go │ ├── walk.go │ └── walk_test.go.bak ├── randutil │ ├── rand.go │ └── rand_test.go.bak ├── ring │ ├── ring_buffer.go │ └── ring_buffer_test.go.bak ├── set │ ├── dedup.go │ └── dedup_test.go ├── stacktrace │ ├── stacktrace.go │ └── stacktrace_test.go.bak ├── stringencoding │ └── string_encoding.go ├── strings.go ├── strings_test.go.bak ├── timeofday │ ├── time_of_day.go │ └── time_of_day_test.go.bak ├── timetz │ ├── timetz.go │ └── timetz_test.go.bak ├── timeutil │ ├── main_test.go.bak │ ├── now_test.go.bak │ ├── now_unix.go │ ├── now_windows.go │ ├── pgdate │ │ ├── field_extract.go │ │ ├── field_extract_test.go.bak │ │ ├── field_string.go │ │ ├── fields.go │ │ ├── fields_test.go.bak │ │ ├── math.go │ │ ├── parsemode_string.go │ │ ├── parsing.go │ │ ├── parsing_test.go.bak │ │ ├── pgdate.go │ │ ├── pgdate_test.go.bak │ │ ├── setters.go │ │ └── zone_cache.go │ ├── stopwatch.go │ ├── stopwatch_test.go.bak │ ├── time.go │ ├── time_test.go.bak │ ├── time_zone_util.go │ ├── time_zone_util_test.go.bak │ ├── timer.go │ ├── timer_test.go.bak │ └── zoneinfo.go ├── uint128 │ ├── uint128.go │ └── uint128_test.go.bak ├── unique │ ├── unique.go │ └── unique_test.go.bak └── uuid │ ├── benchmark_fast_test.go.bak │ ├── codec.go │ ├── codec_test.go.bak │ ├── fuzz.go │ ├── generator.go │ ├── generator_test.go.bak │ ├── sql.go │ ├── sql_test.go.bak │ ├── testdata │ └── corpus │ │ ├── 1416586f4a34d02bcb506f6107b40df512b9f2f9 │ │ ├── 3b46a7e7b02ec193581e6c9fa2c8a72f50a64e08-1 │ │ ├── 50c54bb75fcfdc488f162bf2f0c6dec6103bfa18-5 │ │ ├── 69c581ab749cbd56be8684d3a58ac2cfab9af0f4-5 │ │ ├── 752bf000e0bff06777dd0d6f0be6353844de678a-3 │ │ ├── a4483762d4ece8466d82cca5cacd35a0829c4e60-2 │ │ ├── d0952c45e0c823fc5cc12bcf7d9b877d150ab523-1 │ │ ├── da39a3ee5e6b4b0d3255bfef95601890afd80709 │ │ ├── e2b84d2065846891f18ae109b12e01d224e1c7c3-4 │ │ ├── e320d749435115e874f77420e17d0937e07f69f3-2 │ │ ├── ed132d47d757f6468443a22df8a2a965efb34098-7 │ │ ├── eeefb01f7bb3c627aedb292c994b20f739ffd613-6 │ │ ├── seed_invalid_0 │ │ ├── seed_invalid_1 │ │ ├── seed_invalid_10 │ │ ├── seed_invalid_11 │ │ ├── seed_invalid_12 │ │ ├── seed_invalid_13 │ │ ├── seed_invalid_14 │ │ ├── seed_invalid_15 │ │ ├── seed_invalid_16 │ │ ├── seed_invalid_17 │ │ ├── seed_invalid_18 │ │ ├── seed_invalid_19 │ │ ├── seed_invalid_2 │ │ ├── seed_invalid_20 │ │ ├── seed_invalid_21 │ │ ├── seed_invalid_22 │ │ ├── seed_invalid_23 │ │ ├── seed_invalid_3 │ │ ├── seed_invalid_4 │ │ ├── seed_invalid_5 │ │ ├── seed_invalid_6 │ │ ├── seed_invalid_7 │ │ ├── seed_invalid_8 │ │ ├── seed_invalid_9 │ │ ├── seed_valid_BracedCanonical │ │ ├── seed_valid_BracedHashlike │ │ ├── seed_valid_Canonical │ │ ├── seed_valid_Hashlike │ │ ├── seed_valid_URNCanonical │ │ └── seed_valid_URNHashlike │ ├── uuid.go │ ├── uuid_test.go.bak │ └── uuid_wrapper.go └── walk ├── walker.go └── walker_test.go /.editorconfig: -------------------------------------------------------------------------------- 1 | # See http://editorconfig.org 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | charset = utf-8 7 | 8 | # For non-go files, we indent with two spaces. In go files we indent 9 | # with tabs but still set indent_size to control the github web viewer. 10 | indent_size=4 11 | 12 | # Override default spacing rules for .opt files. 13 | [*.opt] 14 | indent_style = space 15 | indent_size = 4 16 | 17 | # Makefiles are broken without using actual tabs for indentation. 18 | [Makefile] 19 | indent_style = tab 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin -------------------------------------------------------------------------------- /example/walk/walk.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/auxten/postgresql-parser/pkg/sql/parser" 7 | "github.com/auxten/postgresql-parser/pkg/walk" 8 | ) 9 | 10 | func main() { 11 | sql := `select marr 12 | from (select marr_stat_cd AS marr, label AS l 13 | from root_loan_mock_v4 14 | order by root_loan_mock_v4.age desc, l desc 15 | limit 5) as v4 16 | LIMIT 1;` 17 | w := &walk.AstWalker{ 18 | Fn: func(ctx interface{}, node interface{}) (stop bool) { 19 | log.Printf("node type %T", node) 20 | return false 21 | }, 22 | } 23 | stmts, err := parser.Parse(sql) 24 | if err != nil { 25 | return 26 | } 27 | 28 | _, _ = w.Walk(stmts, nil) 29 | return 30 | } 31 | -------------------------------------------------------------------------------- /pkg/sql/lex/experimental_keywords.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package lex 12 | 13 | // AllowedExperimental contains keywords for which the EXPERIMENTAL_ 14 | // or TESTING_ prefixes are allowed to be parsed along with the 15 | // keyword to the same token. This ambiguity exists during the 16 | // deprecation period of an EXPERIMENTAL_ keyword as it is being 17 | // transitioned to the normal version. Once the transition is done, 18 | // the keyword should be removed from here as well. 19 | var AllowedExperimental = map[string]struct{}{ 20 | "ranges": {}, 21 | } 22 | -------------------------------------------------------------------------------- /pkg/sql/parser/base.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | // DocsURLBase is the root URL for the version of the docs associated with this 4 | // binary. 5 | var DocsURLBase = "https://www.cockroachlabs.com/docs/" + "v20.1.11" 6 | 7 | // DocsURL generates the URL to pageName in the version of the docs associated 8 | // with this binary. 9 | func DocsURL(pageName string) string { return DocsURLBase + "/" + pageName } 10 | 11 | -------------------------------------------------------------------------------- /pkg/sql/parser/help_gen_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Trigger this script by running `make generate PKG=./pkg/sql/parser` from the 4 | # repository root to ensure your PATH includes vendored binaries. 5 | 6 | set -euo pipefail 7 | 8 | # We need to set these environment variables to ensure the output of 9 | # `sort` is the same everywhere. 10 | export LC_ALL=C 11 | export LANG=C 12 | 13 | cat < errcodes.generated 18 | -------------------------------------------------------------------------------- /pkg/sql/privilege/kind_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=Kind"; DO NOT EDIT. 2 | 3 | package privilege 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[ALL-1] 12 | _ = x[CREATE-2] 13 | _ = x[DROP-3] 14 | _ = x[GRANT-4] 15 | _ = x[SELECT-5] 16 | _ = x[INSERT-6] 17 | _ = x[DELETE-7] 18 | _ = x[UPDATE-8] 19 | _ = x[ZONECONFIG-9] 20 | } 21 | 22 | const _Kind_name = "ALLCREATEDROPGRANTSELECTINSERTDELETEUPDATEZONECONFIG" 23 | 24 | var _Kind_index = [...]uint8{0, 3, 9, 13, 18, 24, 30, 36, 42, 52} 25 | 26 | func (i Kind) String() string { 27 | i -= 1 28 | if i >= Kind(len(_Kind_index)-1) { 29 | return "Kind(" + strconv.FormatInt(int64(i+1), 10) + ")" 30 | } 31 | return _Kind_name[_Kind_index[i]:_Kind_index[i+1]] 32 | } 33 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/alter_sequence.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package tree 12 | 13 | // AlterSequence represents an ALTER SEQUENCE statement, except in the case of 14 | // ALTER SEQUENCE RENAME TO , which is represented by a 15 | // RenameTable node. 16 | type AlterSequence struct { 17 | IfExists bool 18 | Name *UnresolvedObjectName 19 | Options SequenceOptions 20 | } 21 | 22 | // Format implements the NodeFormatter interface. 23 | func (node *AlterSequence) Format(ctx *FmtCtx) { 24 | ctx.WriteString("ALTER SEQUENCE ") 25 | if node.IfExists { 26 | ctx.WriteString("IF EXISTS ") 27 | } 28 | ctx.FormatNode(node.Name) 29 | ctx.FormatNode(&node.Options) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/comment_on_column.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package tree 12 | 13 | import "github.com/auxten/postgresql-parser/pkg/sql/lex" 14 | 15 | // CommentOnColumn represents an COMMENT ON COLUMN statement. 16 | type CommentOnColumn struct { 17 | *ColumnItem 18 | Comment *string 19 | } 20 | 21 | // Format implements the NodeFormatter interface. 22 | func (n *CommentOnColumn) Format(ctx *FmtCtx) { 23 | ctx.WriteString("COMMENT ON COLUMN ") 24 | ctx.FormatNode(n.ColumnItem) 25 | ctx.WriteString(" IS ") 26 | if n.Comment != nil { 27 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, *n.Comment, ctx.flags.EncodeFlags()) 28 | } else { 29 | ctx.WriteString("NULL") 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/comment_on_database.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package tree 12 | 13 | import "github.com/auxten/postgresql-parser/pkg/sql/lex" 14 | 15 | // CommentOnDatabase represents an COMMENT ON DATABASE statement. 16 | type CommentOnDatabase struct { 17 | Name Name 18 | Comment *string 19 | } 20 | 21 | // Format implements the NodeFormatter interface. 22 | func (n *CommentOnDatabase) Format(ctx *FmtCtx) { 23 | ctx.WriteString("COMMENT ON DATABASE ") 24 | ctx.FormatNode(&n.Name) 25 | ctx.WriteString(" IS ") 26 | if n.Comment != nil { 27 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, *n.Comment, ctx.flags.EncodeFlags()) 28 | } else { 29 | ctx.WriteString("NULL") 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/comment_on_index.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package tree 12 | 13 | import "github.com/auxten/postgresql-parser/pkg/sql/lex" 14 | 15 | // CommentOnIndex represents a COMMENT ON INDEX statement. 16 | type CommentOnIndex struct { 17 | Index TableIndexName 18 | Comment *string 19 | } 20 | 21 | // Format implements the NodeFormatter interface. 22 | func (n *CommentOnIndex) Format(ctx *FmtCtx) { 23 | ctx.WriteString("COMMENT ON INDEX ") 24 | ctx.FormatNode(&n.Index) 25 | ctx.WriteString(" IS ") 26 | if n.Comment != nil { 27 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, *n.Comment, ctx.flags.EncodeFlags()) 28 | } else { 29 | ctx.WriteString("NULL") 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/comment_on_table.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package tree 12 | 13 | import "github.com/auxten/postgresql-parser/pkg/sql/lex" 14 | 15 | // CommentOnTable represents an COMMENT ON TABLE statement. 16 | type CommentOnTable struct { 17 | Table *UnresolvedObjectName 18 | Comment *string 19 | } 20 | 21 | // Format implements the NodeFormatter interface. 22 | func (n *CommentOnTable) Format(ctx *FmtCtx) { 23 | ctx.WriteString("COMMENT ON TABLE ") 24 | ctx.FormatNode(n.Table) 25 | ctx.WriteString(" IS ") 26 | if n.Comment != nil { 27 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, *n.Comment, ctx.flags.EncodeFlags()) 28 | } else { 29 | ctx.WriteString("NULL") 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/export.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package tree 12 | 13 | // Export represents a EXPORT statement. 14 | type Export struct { 15 | Query *Select 16 | FileFormat string 17 | File Expr 18 | Options KVOptions 19 | } 20 | 21 | var _ Statement = &Export{} 22 | 23 | // Format implements the NodeFormatter interface. 24 | func (node *Export) Format(ctx *FmtCtx) { 25 | ctx.WriteString("EXPORT INTO ") 26 | ctx.WriteString(node.FileFormat) 27 | ctx.WriteString(" ") 28 | ctx.FormatNode(node.File) 29 | if node.Options != nil { 30 | ctx.WriteString(" WITH ") 31 | ctx.FormatNode(&node.Options) 32 | } 33 | ctx.WriteString(" FROM ") 34 | ctx.FormatNode(node.Query) 35 | } 36 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/fuzz.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | // +build gofuzz 12 | 13 | package tree 14 | 15 | import "github.com/auxten/postgresql-parser/pkg/util/timeutil" 16 | 17 | var ( 18 | timeCtx = NewParseTimeContext(timeutil.Now()) 19 | ) 20 | 21 | func FuzzParseDDecimal(data []byte) int { 22 | _, err := ParseDDecimal(string(data)) 23 | if err != nil { 24 | return 0 25 | } 26 | return 1 27 | } 28 | 29 | func FuzzParseDDate(data []byte) int { 30 | _, err := ParseDDate(timeCtx, string(data)) 31 | if err != nil { 32 | return 0 33 | } 34 | return 1 35 | } 36 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/statementtype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=StatementType"; DO NOT EDIT. 2 | 3 | package tree 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[Ack-0] 12 | _ = x[DDL-1] 13 | _ = x[RowsAffected-2] 14 | _ = x[Rows-3] 15 | _ = x[CopyIn-4] 16 | _ = x[Unknown-5] 17 | } 18 | 19 | const _StatementType_name = "AckDDLRowsAffectedRowsCopyInUnknown" 20 | 21 | var _StatementType_index = [...]uint8{0, 3, 6, 18, 22, 28, 35} 22 | 23 | func (i StatementType) String() string { 24 | if i < 0 || i >= StatementType(len(_StatementType_index)-1) { 25 | return "StatementType(" + strconv.FormatInt(int64(i), 10) + ")" 26 | } 27 | return _StatementType_name[_StatementType_index[i]:_StatementType_index[i+1]] 28 | } 29 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/table_name_test.go.bak: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package tree_test 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/bitshift: -------------------------------------------------------------------------------- 1 | eval 2 | 1 << 2 3 | ---- 4 | 4 5 | 6 | eval 7 | 4 >> 2 8 | ---- 9 | 1 10 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/bitwise_operators: -------------------------------------------------------------------------------- 1 | eval 2 | 1 & 3 3 | ---- 4 | 1 5 | 6 | eval 7 | 1 | 3 8 | ---- 9 | 3 10 | 11 | eval 12 | 1 # 3 13 | ---- 14 | 2 15 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/case: -------------------------------------------------------------------------------- 1 | # Case operator. 2 | 3 | eval 4 | CASE WHEN true THEN 1 END 5 | ---- 6 | 1 7 | 8 | eval 9 | CASE WHEN false THEN 1 END 10 | ---- 11 | NULL 12 | 13 | eval 14 | CASE WHEN false THEN 1 ELSE 2 END 15 | ---- 16 | 2 17 | 18 | eval 19 | CASE WHEN false THEN 1 WHEN false THEN 2 END 20 | ---- 21 | NULL 22 | 23 | eval 24 | CASE 1+1 WHEN 1 THEN 1 WHEN 2 THEN 2 END 25 | ---- 26 | 2 27 | 28 | eval 29 | CASE 1+2 WHEN 1 THEN 1 WHEN 2 THEN 2 ELSE 5 END 30 | ---- 31 | 5 32 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/concat: -------------------------------------------------------------------------------- 1 | # String concatenation. 2 | 3 | eval 4 | 'a' || 'b' 5 | ---- 6 | 'ab' 7 | 8 | eval 9 | 'a' || (1 + 2)::char 10 | ---- 11 | 'a3' 12 | 13 | eval 14 | b'hello' || 'world' 15 | ---- 16 | '\x68656c6c6f776f726c64' 17 | 18 | eval 19 | array['foo'] || '{a,b}' 20 | ---- 21 | ARRAY['foo','a','b'] 22 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/float_decimal_div: -------------------------------------------------------------------------------- 1 | # Division is always done on floats or decimals. 2 | 3 | eval 4 | 4 / 5 5 | ---- 6 | 0.8 7 | 8 | eval 9 | 1 / 3 10 | ---- 11 | 0.33333333333333333333 12 | 13 | eval 14 | 1 / -3 15 | ---- 16 | -0.33333333333333333333 17 | 18 | eval 19 | -1 / 3 20 | ---- 21 | -0.33333333333333333333 22 | 23 | eval 24 | -1 / -3 25 | ---- 26 | 0.33333333333333333333 27 | 28 | eval 29 | 1.1:::decimal / 2.2:::decimal 30 | ---- 31 | 0.5 32 | 33 | eval 34 | 1:::int / 2.2:::decimal 35 | ---- 36 | 0.45454545454545454545 37 | 38 | eval 39 | 1.1:::decimal / 2:::int 40 | ---- 41 | 0.55 42 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/grouping: -------------------------------------------------------------------------------- 1 | eval 2 | 1 + 2 + (3 * 4) 3 | ---- 4 | 15 5 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/hex: -------------------------------------------------------------------------------- 1 | # Hexadecimal numbers. 2 | 3 | eval 4 | 0xa 5 | ---- 6 | 10 7 | 8 | eval 9 | 0xcafe1111 10 | ---- 11 | 3405648145 12 | 13 | # Hexadecimal bytes literals. 14 | 15 | eval 16 | x'636174' 17 | ---- 18 | '\x636174' 19 | 20 | eval 21 | X'636174' 22 | ---- 23 | '\x636174' 24 | 25 | eval 26 | pg_typeof(x'636174') 27 | ---- 28 | 'bytes' 29 | 30 | eval 31 | '\x636174'::bytes 32 | ---- 33 | '\x636174' 34 | 35 | eval 36 | x'636174'::string 37 | ---- 38 | 'cat' 39 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/int_decimal_arith: -------------------------------------------------------------------------------- 1 | # Heterogeneous int/decimal arithmetic is valid. 2 | 3 | eval 4 | 1.1:::decimal + 2:::int 5 | ---- 6 | 3.1 7 | 8 | eval 9 | 1.1:::decimal - 2:::int 10 | ---- 11 | -0.9 12 | 13 | eval 14 | 1.1:::decimal * 2:::int 15 | ---- 16 | 2.2 17 | 18 | eval 19 | 1.1:::decimal % 2:::int 20 | ---- 21 | 1.1 22 | 23 | eval 24 | 4.1:::decimal // 2:::int 25 | ---- 26 | 2 27 | 28 | eval 29 | 1.1:::decimal ^ 2:::int 30 | ---- 31 | 1.21 32 | 33 | eval 34 | 2:::int + 2.1:::decimal 35 | ---- 36 | 4.1 37 | 38 | eval 39 | 2:::int - 2.1:::decimal 40 | ---- 41 | -0.1 42 | 43 | eval 44 | 2:::int * 2.1:::decimal 45 | ---- 46 | 4.2 47 | 48 | eval 49 | 2:::int % 2.1:::decimal 50 | ---- 51 | 2.0 52 | 53 | eval 54 | 4:::int // 2.1:::decimal 55 | ---- 56 | 1 57 | 58 | eval 59 | 2:::int ^ 2.1:::decimal 60 | ---- 61 | 4.2870938501451726569 62 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/int_min: -------------------------------------------------------------------------------- 1 | # Verify INT_MIN / -1 = -INT_MIN. 2 | eval 3 | (-9223372036854775807:::int - 1) / -1 4 | ---- 5 | 9223372036854775808 6 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/oid: -------------------------------------------------------------------------------- 1 | eval 2 | 1:::OID 3 | ---- 4 | 1 5 | 6 | eval 7 | 2:::REGPROC 8 | ---- 9 | 2 10 | 11 | eval 12 | 3:::REGCLASS 13 | ---- 14 | 3 15 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/ones_complement: -------------------------------------------------------------------------------- 1 | # Ones complement operates on signed integers. 2 | 3 | eval 4 | ~0 5 | ---- 6 | -1 7 | 8 | eval 9 | ~0 - 1 10 | ---- 11 | -2 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/eval/unary: -------------------------------------------------------------------------------- 1 | # Unary operators 2 | 3 | eval 4 | -3 5 | ---- 6 | -3 7 | 8 | eval 9 | -4.1 10 | ---- 11 | -4.1 12 | 13 | eval 14 | -6.1:::float 15 | ---- 16 | -6.1 17 | 18 | eval 19 | - -1 20 | ---- 21 | 1 22 | 23 | eval 24 | - -1:::float 25 | ---- 26 | 1.0 27 | 28 | eval 29 | - +1 30 | ---- 31 | -1 32 | 33 | eval 34 | + -1 35 | ---- 36 | -1 37 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/1.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | 1 7 | 8 | 8: 9 | -------- 10 | SELECT 1 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/1.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/1.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | 1 7 | 8 | 8: 9 | -------- 10 | SELECT 1 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/1.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/1.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | 1 7 | 8 | 8: 9 | -------- 10 | SELECT 1 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/1.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/1.sql: -------------------------------------------------------------------------------- 1 | select 1 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/10.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | 1, 7 | 2, 8 | 3 9 | 10 | 9: 11 | --------- 12 | SELECT 1, 13 | 2, 14 | 3 15 | 16 | 14: 17 | -------------- 18 | SELECT 1, 2, 3 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/10.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1, 2, 3 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/10.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | 1, 7 | 2, 8 | 3 9 | 10 | 9: 11 | --------- 12 | SELECT 1, 13 | 2, 14 | 3 15 | 16 | 14: 17 | -------------- 18 | SELECT 1, 2, 3 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/10.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1, 2, 3 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/10.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | 1, 7 | 2, 8 | 3 9 | 10 | 11: 11 | ----------- 12 | SELECT 13 | 1, 2, 3 14 | 15 | 14: 16 | -------------- 17 | SELECT 1, 2, 3 18 | 19 | 20 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/10.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1, 2, 3 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/10.sql: -------------------------------------------------------------------------------- 1 | select 1,2,3 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/11.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | fn( 7 | 1, 8 | 2 9 | ) 10 | 11 | 10: 12 | ---------- 13 | SELECT fn( 14 | 1, 15 | 2 16 | ) 17 | 18 | 15: 19 | --------------- 20 | SELECT fn(1, 2) 21 | 22 | 23 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/11.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT fn(1, 2) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/11.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | fn( 7 | 1, 8 | 2 9 | ) 10 | 11 | 10: 12 | ---------- 13 | SELECT fn( 14 | 1, 15 | 2 16 | ) 17 | 18 | 15: 19 | --------------- 20 | SELECT fn(1, 2) 21 | 22 | 23 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/11.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT fn(1, 2) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/11.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | fn( 7 | 1, 8 | 2 9 | ) 10 | 11 | 12: 12 | ------------ 13 | SELECT 14 | fn(1, 2) 15 | 16 | 15: 17 | --------------- 18 | SELECT fn(1, 2) 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/11.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT fn(1, 2) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/11.sql: -------------------------------------------------------------------------------- 1 | select fn(1, 2) 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/12.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT 6 | INTO 7 | t 8 | ( 9 | a, 10 | b 11 | ) 12 | VALUES 13 | ( 14 | 1, 15 | 2 16 | ) 17 | 18 | 6: 19 | ------ 20 | INSERT 21 | INTO t 22 | ( 23 | a, 24 | b 25 | ) 26 | VALUES ( 27 | 1, 28 | 2 29 | ) 30 | 31 | 10: 32 | ---------- 33 | INSERT 34 | INTO t ( 35 | a, 36 | b 37 | ) 38 | VALUES ( 39 | 1, 40 | 2 41 | ) 42 | 43 | 13: 44 | ------------- 45 | INSERT 46 | INTO t ( 47 | a, 48 | b 49 | ) 50 | VALUES (1, 2) 51 | 52 | 15: 53 | --------------- 54 | INSERT 55 | INTO t (a, b) 56 | VALUES (1, 2) 57 | 58 | 34: 59 | ---------------------------------- 60 | INSERT INTO t (a, b) VALUES (1, 2) 61 | 62 | 63 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/12.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT INTO t (a, b) VALUES (1, 2) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/12.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT 6 | INTO 7 | t 8 | ( 9 | a, 10 | b 11 | ) 12 | VALUES 13 | ( 14 | 1, 15 | 2 16 | ) 17 | 18 | 6: 19 | ------ 20 | INSERT 21 | INTO t 22 | ( 23 | a, 24 | b 25 | ) 26 | VALUES ( 27 | 1, 28 | 2 29 | ) 30 | 31 | 10: 32 | ---------- 33 | INSERT 34 | INTO t ( 35 | a, 36 | b 37 | ) 38 | VALUES ( 39 | 1, 40 | 2 41 | ) 42 | 43 | 13: 44 | ------------- 45 | INSERT 46 | INTO t ( 47 | a, 48 | b 49 | ) 50 | VALUES (1, 2) 51 | 52 | 15: 53 | --------------- 54 | INSERT 55 | INTO t (a, b) 56 | VALUES (1, 2) 57 | 58 | 34: 59 | ---------------------------------- 60 | INSERT INTO t (a, b) VALUES (1, 2) 61 | 62 | 63 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/12.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT INTO t (a, b) VALUES (1, 2) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/12.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT 6 | INTO 7 | t 8 | ( 9 | a, 10 | b 11 | ) 12 | VALUES 13 | ( 14 | 1, 15 | 2 16 | ) 17 | 18 | 10: 19 | ---------- 20 | INSERT 21 | INTO 22 | t 23 | ( 24 | a, 25 | b 26 | ) 27 | VALUES 28 | (1, 2) 29 | 30 | 12: 31 | ------------ 32 | INSERT 33 | INTO 34 | t (a, b) 35 | VALUES 36 | (1, 2) 37 | 38 | 34: 39 | ---------------------------------- 40 | INSERT INTO t (a, b) VALUES (1, 2) 41 | 42 | 43 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/12.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT INTO t (a, b) VALUES (1, 2) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/12.sql: -------------------------------------------------------------------------------- 1 | insert into t (a, b) values (1, 2) 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/13.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | 1, 7 | 2 8 | 9 | 8: 10 | -------- 11 | SELECT 12 | 1, 2 13 | 14 | 9: 15 | --------- 16 | SELECT 1, 17 | 2 18 | 19 | 11: 20 | ----------- 21 | SELECT 1, 2 22 | 23 | 24 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/13.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1, 2 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/13.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | 1, 7 | 2 8 | 9 | 8: 10 | -------- 11 | SELECT 12 | 1, 2 13 | 14 | 9: 15 | --------- 16 | SELECT 1, 17 | 2 18 | 19 | 11: 20 | ----------- 21 | SELECT 1, 2 22 | 23 | 24 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/13.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1, 2 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/13.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | 1, 7 | 2 8 | 9 | 8: 10 | -------- 11 | SELECT 12 | 1, 2 13 | 14 | 11: 15 | ----------- 16 | SELECT 1, 2 17 | 18 | 19 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/13.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1, 2 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/13.sql: -------------------------------------------------------------------------------- 1 | SELECT ((1)), 2 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/14.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | UPDATE abc 6 | SET (b, c) = (8, 9) 7 | WHERE a = 2 AND b = c 8 | ORDER BY v DESC 9 | LIMIT 1 10 | RETURNING abc.b, c, 4 AS d 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/14.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | UPDATE abc 6 | SET (b, c) = (8, 9) 7 | WHERE a = 2 AND b = c 8 | ORDER BY v DESC 9 | LIMIT 1 10 | RETURNING abc.b, c, 4 AS d 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/14.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | UPDATE 6 | abc 7 | SET 8 | (b, c) = (8, 9) 9 | WHERE 10 | a = 2 AND b = c 11 | ORDER BY 12 | v DESC 13 | LIMIT 14 | 1 15 | RETURNING 16 | abc.b, c, 4 AS d 17 | 18 | 19 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/14.sql: -------------------------------------------------------------------------------- 1 | UPDATE abc SET (b, c) = (8, 9) WHERE a=2 and b=c ORDER BY v DESC LIMIT 1 RETURNING abc.b, c, 4 AS d 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/15.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | DISTINCT ON (pk1, pk2, x, y) 7 | x, 8 | y, 9 | z 10 | FROM 11 | xyz 12 | ORDER BY 13 | x, 14 | y 15 | 16 | 8: 17 | -------- 18 | SELECT 19 | DISTINCT ON (pk1, pk2, x, y) 20 | x, 21 | y, 22 | z 23 | FROM 24 | xyz 25 | ORDER BY 26 | x, y 27 | 28 | 37: 29 | ------------------------------------- 30 | SELECT DISTINCT ON (pk1, pk2, x, y) 31 | x, 32 | y, 33 | z 34 | FROM xyz 35 | ORDER BY x, y 36 | 37 | 45: 38 | --------------------------------------------- 39 | SELECT DISTINCT ON (pk1, pk2, x, y) x, y, z 40 | FROM xyz 41 | ORDER BY x, y 42 | 43 | 66: 44 | ------------------------------------------------------------------ 45 | SELECT DISTINCT ON (pk1, pk2, x, y) x, y, z FROM xyz ORDER BY x, y 46 | 47 | 48 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/15.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT DISTINCT ON (pk1, pk2, x, y) 6 | x, 7 | y, 8 | z 9 | FROM xyz 10 | ORDER BY x, y 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/15.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | DISTINCT ON (pk1, pk2, x, y) 7 | x, 8 | y, 9 | z 10 | FROM 11 | xyz 12 | ORDER BY 13 | x, 14 | y 15 | 16 | 8: 17 | -------- 18 | SELECT 19 | DISTINCT ON (pk1, pk2, x, y) 20 | x, 21 | y, 22 | z 23 | FROM 24 | xyz 25 | ORDER BY 26 | x, y 27 | 28 | 37: 29 | ------------------------------------- 30 | SELECT DISTINCT ON (pk1, pk2, x, y) 31 | x, 32 | y, 33 | z 34 | FROM xyz 35 | ORDER BY x, y 36 | 37 | 45: 38 | --------------------------------------------- 39 | SELECT DISTINCT ON (pk1, pk2, x, y) x, y, z 40 | FROM xyz 41 | ORDER BY x, y 42 | 43 | 66: 44 | ------------------------------------------------------------------ 45 | SELECT DISTINCT ON (pk1, pk2, x, y) x, y, z FROM xyz ORDER BY x, y 46 | 47 | 48 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/15.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT DISTINCT ON (pk1, pk2, x, y) 6 | x, 7 | y, 8 | z 9 | FROM xyz 10 | ORDER BY x, y 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/15.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | DISTINCT ON (pk1, pk2, x, y) 7 | x, 8 | y, 9 | z 10 | FROM 11 | xyz 12 | ORDER BY 13 | x, 14 | y 15 | 16 | 8: 17 | -------- 18 | SELECT 19 | DISTINCT ON (pk1, pk2, x, y) 20 | x, 21 | y, 22 | z 23 | FROM 24 | xyz 25 | ORDER BY 26 | x, y 27 | 28 | 40: 29 | ---------------------------------------- 30 | SELECT 31 | DISTINCT ON (pk1, pk2, x, y) x, y, z 32 | FROM 33 | xyz 34 | ORDER BY 35 | x, y 36 | 37 | 66: 38 | ------------------------------------------------------------------ 39 | SELECT DISTINCT ON (pk1, pk2, x, y) x, y, z FROM xyz ORDER BY x, y 40 | 41 | 42 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/15.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | DISTINCT ON (pk1, pk2, x, y) x, y, z 7 | FROM 8 | xyz 9 | ORDER BY 10 | x, y 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/15.sql: -------------------------------------------------------------------------------- 1 | SELECT DISTINCT ON(pk1, pk2, x, y) x, y, z FROM xyz ORDER BY x, y 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/16.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | DELETE FROM unindexed 6 | WHERE k > 1 AND v < 7 7 | ORDER BY v DESC 8 | RETURNING v, k 9 | 10 | 11 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/16.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | DELETE FROM unindexed 6 | WHERE k > 1 AND v < 7 7 | ORDER BY v DESC 8 | RETURNING v, k 9 | 10 | 11 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/16.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | DELETE FROM 6 | unindexed 7 | WHERE 8 | k > 1 AND v < 7 9 | ORDER BY 10 | v DESC 11 | RETURNING 12 | v, k 13 | 14 | 15 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/16.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM unindexed WHERE k > 1 AND v < 7 ORDER BY v DESC RETURNING v,k 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/17.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT * 6 | FROM a 7 | ORDER BY INDEX abc2@ba DESC, 8 | INDEX abc2@ba, 9 | PRIMARY KEY abc2 DESC, 10 | "foo.bar" ASC 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/17.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT * 6 | FROM a 7 | ORDER BY INDEX abc2@ba DESC, 8 | INDEX abc2@ba, 9 | PRIMARY KEY abc2 DESC, 10 | "foo.bar" ASC 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/17.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | * 7 | FROM 8 | a 9 | ORDER BY 10 | INDEX abc2@ba DESC, 11 | INDEX abc2@ba, 12 | PRIMARY KEY abc2 DESC, 13 | "foo.bar" ASC 14 | 15 | 16 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/17.sql: -------------------------------------------------------------------------------- 1 | select * from a order by index abc2@ba desc, INDEX abc2@ba, PRIMARY KEY abc2 DESC, "foo.bar" ASC 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/18.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | WITH t (x) AS ( 6 | WITH t (x) AS ( 7 | SELECT 1 8 | ) 9 | SELECT x * 10 10 | FROM t 11 | ) 12 | SELECT x + 2 13 | FROM t 14 | 15 | 16 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/18.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | WITH t (x) AS ( 6 | WITH t (x) AS ( 7 | SELECT 1 8 | ) 9 | SELECT x * 10 10 | FROM t 11 | ) 12 | SELECT x + 2 13 | FROM t 14 | 15 | 16 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/18.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | WITH 6 | t (x) 7 | AS ( 8 | WITH 9 | t (x) AS (SELECT 1) 10 | SELECT 11 | x * 10 12 | FROM 13 | t 14 | ) 15 | SELECT 16 | x + 2 17 | FROM 18 | t 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/18.sql: -------------------------------------------------------------------------------- 1 | WITH t(x) AS (WITH t(x) AS (SELECT 1) SELECT x * 10 FROM t) SELECT x + 2 FROM t 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/19.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | BOOL 'foo' 7 | 8 | 17: 9 | ----------------- 10 | SELECT BOOL 'foo' 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/19.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT BOOL 'foo' 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/19.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | BOOL 'foo' 7 | 8 | 17: 9 | ----------------- 10 | SELECT BOOL 'foo' 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/19.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT BOOL 'foo' 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/19.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | BOOL 'foo' 7 | 8 | 17: 9 | ----------------- 10 | SELECT BOOL 'foo' 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/19.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT BOOL 'foo' 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/19.sql: -------------------------------------------------------------------------------- 1 | select bool 'foo' 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/2.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT count(*) AS count, 6 | winner, 7 | counter * 60 * 5 AS counter 8 | FROM ( 9 | SELECT winner, 10 | round( 11 | length / 60 / 5 12 | ) AS counter 13 | FROM players 14 | WHERE build = $1 15 | AND ( 16 | hero = $2 17 | OR region = $3 18 | ) 19 | ) 20 | GROUP BY winner, counter 21 | 22 | 23 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/2.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT count(*) AS count, 6 | winner, 7 | counter * 60 * 5 AS counter 8 | FROM ( 9 | SELECT winner, 10 | round( 11 | length / 60 / 5 12 | ) AS counter 13 | FROM players 14 | WHERE build = $1 15 | AND ( 16 | hero = $2 17 | OR region = $3 18 | ) 19 | ) 20 | GROUP BY winner, counter 21 | 22 | 23 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/2.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | count(*) AS count, 7 | winner, 8 | counter * 60 * 5 AS counter 9 | FROM 10 | ( 11 | SELECT 12 | winner, 13 | round(length / 60 / 5) 14 | AS counter 15 | FROM 16 | players 17 | WHERE 18 | build = $1 19 | AND ( 20 | hero = $2 21 | OR region = $3 22 | ) 23 | ) 24 | GROUP BY 25 | winner, counter 26 | 27 | 28 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/2.sql: -------------------------------------------------------------------------------- 1 | SELECT count(*) count, winner, counter * 60 * 5 as counter FROM (SELECT winner, round(length / 60 / 5) as counter FROM players WHERE build = $1 AND (hero = $2 OR region = $3)) GROUP BY winner, counter 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/20.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | a INT8, b INT8, c INT8, 7 | PRIMARY KEY (a, b) 8 | ) INTERLEAVE IN PARENT p2 (i) 9 | PARTITION BY LIST (a) ( 10 | PARTITION p1 11 | VALUES IN ( 12 | 1 13 | ), 14 | PARTITION p2 15 | VALUES IN ( 16 | 2 17 | ) 18 | ) 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/20.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | a INT8, b INT8, c INT8, 7 | PRIMARY KEY (a, b) 8 | ) INTERLEAVE IN PARENT p2 (i) 9 | PARTITION BY LIST (a) ( 10 | PARTITION p1 11 | VALUES IN ( 12 | 1 13 | ), 14 | PARTITION p2 15 | VALUES IN ( 16 | 2 17 | ) 18 | ) 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/20.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | a INT8, b INT8, c INT8, 7 | PRIMARY KEY (a, b) 8 | ) 9 | INTERLEAVE IN PARENT p2 (i) 10 | PARTITION BY LIST (a) 11 | ( 12 | PARTITION p1 VALUES IN (1), 13 | PARTITION p2 VALUES IN (2) 14 | ) 15 | 16 | 17 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/20.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE t (a INT, b INT, c INT, PRIMARY KEY (a, b)) INTERLEAVE IN PARENT p2 (i) PARTITION BY LIST (a) ( 2 | PARTITION p1 VALUES IN (1), 3 | PARTITION p2 VALUES IN (2) 4 | ) 5 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/21.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | CAST( 7 | ' 8 | { 9 | "a": 10 | "b" 11 | } 12 | '::JSONB 13 | AS STRING 14 | ) 15 | 16 | 9: 17 | --------- 18 | SELECT 19 | CAST( 20 | ' 21 | { 22 | "a": 23 | "b" 24 | } 25 | '::JSONB AS STRING 26 | ) 27 | 28 | 12: 29 | ------------ 30 | SELECT CAST( 31 | ' 32 | { 33 | "a": 34 | "b" 35 | } 36 | '::JSONB AS STRING 37 | ) 38 | 39 | 22: 40 | ---------------------- 41 | SELECT CAST( 42 | ' 43 | {"a": "b"} 44 | '::JSONB AS STRING 45 | ) 46 | 47 | 37: 48 | ------------------------------------- 49 | SELECT CAST( 50 | '{"a": "b"}'::JSONB AS STRING 51 | ) 52 | 53 | 42: 54 | ------------------------------------------ 55 | SELECT CAST('{"a": "b"}'::JSONB AS STRING) 56 | 57 | 58 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/21.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT CAST( 6 | '{"a": "b"}'::JSONB AS STRING 7 | ) 8 | 9 | 10 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/21.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | CAST( 7 | ' 8 | { 9 | "a": 10 | "b" 11 | } 12 | '::JSONB 13 | AS STRING 14 | ) 15 | 16 | 9: 17 | --------- 18 | SELECT 19 | CAST( 20 | ' 21 | { 22 | "a": 23 | "b" 24 | } 25 | '::JSONB AS STRING 26 | ) 27 | 28 | 12: 29 | ------------ 30 | SELECT CAST( 31 | ' 32 | { 33 | "a": 34 | "b" 35 | } 36 | '::JSONB AS STRING 37 | ) 38 | 39 | 22: 40 | ---------------------- 41 | SELECT CAST( 42 | ' 43 | {"a": "b"} 44 | '::JSONB AS STRING 45 | ) 46 | 47 | 37: 48 | ------------------------------------- 49 | SELECT CAST( 50 | '{"a": "b"}'::JSONB AS STRING 51 | ) 52 | 53 | 42: 54 | ------------------------------------------ 55 | SELECT CAST('{"a": "b"}'::JSONB AS STRING) 56 | 57 | 58 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/21.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT CAST( 6 | '{"a": "b"}'::JSONB AS STRING 7 | ) 8 | 9 | 10 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/21.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | CAST( 7 | ' 8 | { 9 | "a": 10 | "b" 11 | } 12 | '::JSONB 13 | AS STRING 14 | ) 15 | 16 | 22: 17 | ---------------------- 18 | SELECT 19 | CAST( 20 | ' 21 | {"a": "b"} 22 | '::JSONB 23 | AS STRING 24 | ) 25 | 26 | 27: 27 | --------------------------- 28 | SELECT 29 | CAST( 30 | '{"a": "b"}'::JSONB 31 | AS STRING 32 | ) 33 | 34 | 37: 35 | ------------------------------------- 36 | SELECT 37 | CAST( 38 | '{"a": "b"}'::JSONB AS STRING 39 | ) 40 | 41 | 39: 42 | --------------------------------------- 43 | SELECT 44 | CAST('{"a": "b"}'::JSONB AS STRING) 45 | 46 | 42: 47 | ------------------------------------------ 48 | SELECT CAST('{"a": "b"}'::JSONB AS STRING) 49 | 50 | 51 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/21.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | CAST('{"a": "b"}'::JSONB AS STRING) 7 | 8 | 9 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/21.sql: -------------------------------------------------------------------------------- 1 | SELECT CAST('{"a": "b"}'::JSONB AS STRING) 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/22.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | UPDATE abc 6 | SET b = old.b + 1, c = old.c + 1 7 | FROM abc AS old 8 | WHERE abc.a = 2 AND abc.b = abc.c 9 | ORDER BY abc.v DESC 10 | LIMIT 1 11 | RETURNING abc.b, c, 4 AS d 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/22.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | UPDATE abc 6 | SET b = old.b + 1, c = old.c + 1 7 | FROM abc AS old 8 | WHERE abc.a = 2 AND abc.b = abc.c 9 | ORDER BY abc.v DESC 10 | LIMIT 1 11 | RETURNING abc.b, c, 4 AS d 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/22.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | UPDATE 6 | abc 7 | SET 8 | b = old.b + 1, c = old.c + 1 9 | FROM 10 | abc AS old 11 | WHERE 12 | abc.a = 2 AND abc.b = abc.c 13 | ORDER BY 14 | abc.v DESC 15 | LIMIT 16 | 1 17 | RETURNING 18 | abc.b, c, 4 AS d 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/22.sql: -------------------------------------------------------------------------------- 1 | UPDATE abc SET b = old.b + 1, c = old.c + 1 FROM abc AS old WHERE abc.a=2 and abc.b=abc.c ORDER BY abc.v DESC LIMIT 1 RETURNING abc.b, c, 4 AS d 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/3.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | ( 7 | SELECT 8 | 1 9 | ) 10 | 11 | 8: 12 | -------- 13 | SELECT ( 14 | SELECT 15 | 1 16 | ) 17 | 18 | 16: 19 | ---------------- 20 | SELECT ( 21 | SELECT 1 22 | ) 23 | 24 | 17: 25 | ----------------- 26 | SELECT (SELECT 1) 27 | 28 | 29 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/3.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT (SELECT 1) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/3.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | ( 7 | SELECT 8 | 1 9 | ) 10 | 11 | 8: 12 | -------- 13 | SELECT ( 14 | SELECT 15 | 1 16 | ) 17 | 18 | 16: 19 | ---------------- 20 | SELECT ( 21 | SELECT 1 22 | ) 23 | 24 | 17: 25 | ----------------- 26 | SELECT (SELECT 1) 27 | 28 | 29 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/3.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT (SELECT 1) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/3.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | ( 7 | SELECT 8 | 1 9 | ) 10 | 11 | 14: 12 | -------------- 13 | SELECT 14 | (SELECT 1) 15 | 16 | 17: 17 | ----------------- 18 | SELECT (SELECT 1) 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/3.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT (SELECT 1) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/3.sql: -------------------------------------------------------------------------------- 1 | select (select (1)) 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/5.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | "primary", 7 | 'primary' 8 | 9 | 17: 10 | ----------------- 11 | SELECT "primary", 12 | 'primary' 13 | 14 | 27: 15 | --------------------------- 16 | SELECT "primary", 'primary' 17 | 18 | 19 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/5.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT "primary", 'primary' 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/5.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | "primary", 7 | 'primary' 8 | 9 | 17: 10 | ----------------- 11 | SELECT "primary", 12 | 'primary' 13 | 14 | 27: 15 | --------------------------- 16 | SELECT "primary", 'primary' 17 | 18 | 19 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/5.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT "primary", 'primary' 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/5.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | "primary", 7 | 'primary' 8 | 9 | 24: 10 | ------------------------ 11 | SELECT 12 | "primary", 'primary' 13 | 14 | 27: 15 | --------------------------- 16 | SELECT "primary", 'primary' 17 | 18 | 19 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/5.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT "primary", 'primary' 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/5.sql: -------------------------------------------------------------------------------- 1 | select "primary", 'primary' 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/6.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT 6 | INTO kv2 (k, v) 7 | VALUES ('a', 'b'), 8 | ('c', 'd'), 9 | ('e', 'f'), 10 | ('f', 'g'), 11 | (ARRAY[NULL::INT8]), 12 | (ARRAY[NULL::INT8, 1]), 13 | (ARRAY[1, NULL::INT8]), 14 | (ARRAY[NULL::INT8, NULL::INT8]), 15 | (9 / 3 * 1 / 3), 16 | (2.0), 17 | (2.4 + 4.6) 18 | 19 | 20 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/6.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT 6 | INTO kv2 (k, v) 7 | VALUES ('a', 'b'), 8 | ('c', 'd'), 9 | ('e', 'f'), 10 | ('f', 'g'), 11 | (ARRAY[NULL::INT8]), 12 | (ARRAY[NULL::INT8, 1]), 13 | (ARRAY[1, NULL::INT8]), 14 | (ARRAY[NULL::INT8, NULL::INT8]), 15 | (9 / 3 * 1 / 3), 16 | (2.0), 17 | (2.4 + 4.6) 18 | 19 | 20 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/6.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT 6 | INTO 7 | kv2 (k, v) 8 | VALUES 9 | ('a', 'b'), 10 | ('c', 'd'), 11 | ('e', 'f'), 12 | ('f', 'g'), 13 | (ARRAY[NULL::INT8]), 14 | (ARRAY[NULL::INT8, 1]), 15 | (ARRAY[1, NULL::INT8]), 16 | (ARRAY[NULL::INT8, NULL::INT8]), 17 | (9 / 3 * 1 / 3), 18 | (2.0), 19 | (2.4 + 4.6) 20 | 21 | 22 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/6.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO kv2(k, v) VALUES ('a', 'b'), ('c', 'd'), ('e', 'f'), ('f', 'g'), (ARRAY[NULL::INT]), (ARRAY[NULL::INT, 1]), (ARRAY[1, NULL::INT]), (ARRAY[NULL::INT, NULL::INT]), (((9 / 3) * (1 / 3))), (2.0), (2.4 + 4.6) 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/7.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT 6 | INTO mnop (m, n) 7 | SELECT i, (1e9 + i / 2e4)::FLOAT8 8 | FROM generate_series(1, 2e4) AS i ( 9 | i 10 | ) 11 | RETURNING NOTHING 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/7.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT 6 | INTO mnop (m, n) 7 | SELECT i, (1e9 + i / 2e4)::FLOAT8 8 | FROM generate_series(1, 2e4) AS i ( 9 | i 10 | ) 11 | RETURNING NOTHING 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/7.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | INSERT 6 | INTO 7 | mnop (m, n) 8 | SELECT 9 | i, (1e9 + i / 2e4)::FLOAT8 10 | FROM 11 | generate_series(1, 2e4) AS i (i) 12 | RETURNING 13 | NOTHING 14 | 15 | 16 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/7.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO mnop (m, n) SELECT i, (1e9 + i/2e4)::float FROM generate_series(1, 2e4) AS i(i) RETURNING NOTHING 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/8.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT count(*) 6 | FROM [ 7 | DELETE FROM unindexed 8 | LIMIT 5 9 | RETURNING v 10 | ] 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/8.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT count(*) 6 | FROM [ 7 | DELETE FROM unindexed 8 | LIMIT 5 9 | RETURNING v 10 | ] 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/8.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | count( 7 | * 8 | ) 9 | FROM 10 | [ 11 | DELETE FROM 12 | unindexed 13 | LIMIT 14 | 5 15 | RETURNING 16 | v 17 | ] 18 | 19 | 12: 20 | ------------ 21 | SELECT 22 | count(*) 23 | FROM 24 | [ 25 | DELETE FROM 26 | unindexed 27 | LIMIT 28 | 5 29 | RETURNING 30 | v 31 | ] 32 | 33 | 47: 34 | ----------------------------------------------- 35 | SELECT 36 | count(*) 37 | FROM 38 | [DELETE FROM unindexed LIMIT 5 RETURNING v] 39 | 40 | 64: 41 | ---------------------------------------------------------------- 42 | SELECT count(*) FROM [DELETE FROM unindexed LIMIT 5 RETURNING v] 43 | 44 | 45 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/8.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | count(*) 7 | FROM 8 | [ 9 | DELETE FROM 10 | unindexed 11 | LIMIT 12 | 5 13 | RETURNING 14 | v 15 | ] 16 | 17 | 18 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/8.sql: -------------------------------------------------------------------------------- 1 | SELECT count(*) FROM [DELETE FROM unindexed LIMIT 5 RETURNING v] 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/9.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT ( 6 | ( 7 | ( 8 | ( 9 | ( 10 | (1, '2', 3) 11 | AS a, b, c 12 | ), 13 | ((4, '5') AS a, b), 14 | ((6,) AS a) 15 | ) 16 | AS a, b, c 17 | ), 18 | ((7, 8) AS a, b), 19 | (('9',) AS a) 20 | ) 21 | AS a, b, c 22 | ) AS r 23 | 24 | 25 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/9.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT ( 6 | ( 7 | ( 8 | ( 9 | ( 10 | (1, '2', 3) 11 | AS a, b, c 12 | ), 13 | ((4, '5') AS a, b), 14 | ((6,) AS a) 15 | ) 16 | AS a, b, c 17 | ), 18 | ((7, 8) AS a, b), 19 | (('9',) AS a) 20 | ) 21 | AS a, b, c 22 | ) AS r 23 | 24 | 25 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/9.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | ( 7 | ( 8 | ( 9 | ( 10 | ( 11 | (1, '2', 3) 12 | AS a, b, c 13 | ), 14 | ((4, '5') AS a, b), 15 | ((6,) AS a) 16 | ) 17 | AS a, b, c 18 | ), 19 | ((7, 8) AS a, b), 20 | (('9',) AS a) 21 | ) 22 | AS a, b, c 23 | ) 24 | AS r 25 | 26 | 27 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/9.sql: -------------------------------------------------------------------------------- 1 | SELECT ((((((1, '2', 3) AS a, b, c), ((4,'5') AS a, b), (ROW(6) AS a)) AS a, b, c), ((7, 8) AS a, b), (ROW('9') AS a)) AS a, b, c) AS r 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/andor.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | a 7 | AND ( 8 | b 9 | OR c 10 | ) 11 | AND d, 12 | a 13 | OR ( 14 | b 15 | AND c 16 | ) 17 | OR d 18 | 19 | 8: 20 | -------- 21 | SELECT a 22 | AND ( 23 | b 24 | OR c 25 | ) 26 | AND d, 27 | a 28 | OR ( 29 | b 30 | AND c 31 | ) 32 | OR d 33 | 34 | 15: 35 | --------------- 36 | SELECT a 37 | AND (b OR c) 38 | AND d, 39 | a 40 | OR ( 41 | b 42 | AND c 43 | ) 44 | OR d 45 | 46 | 16: 47 | ---------------- 48 | SELECT a 49 | AND (b OR c) 50 | AND d, 51 | a 52 | OR (b AND c) 53 | OR d 54 | 55 | 48: 56 | ------------------------------------------------ 57 | SELECT a AND (b OR c) AND d, a OR (b AND c) OR d 58 | 59 | 60 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/andor.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT a 6 | AND (b OR c) 7 | AND d, 8 | a 9 | OR (b AND c) 10 | OR d 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/andor.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | a 7 | AND ( 8 | b 9 | OR c 10 | ) 11 | AND d, 12 | a 13 | OR ( 14 | b 15 | AND c 16 | ) 17 | OR d 18 | 19 | 8: 20 | -------- 21 | SELECT a 22 | AND ( 23 | b 24 | OR c 25 | ) 26 | AND d, 27 | a 28 | OR ( 29 | b 30 | AND c 31 | ) 32 | OR d 33 | 34 | 19: 35 | ------------------- 36 | SELECT a 37 | AND (b OR c) 38 | AND d, 39 | a 40 | OR (b AND c) 41 | OR d 42 | 43 | 48: 44 | ------------------------------------------------ 45 | SELECT a AND (b OR c) AND d, a OR (b AND c) OR d 46 | 47 | 48 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/andor.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT a 6 | AND (b OR c) 7 | AND d, 8 | a 9 | OR (b AND c) 10 | OR d 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/andor.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | a 7 | AND ( 8 | b 9 | OR c 10 | ) 11 | AND d, 12 | a 13 | OR ( 14 | b 15 | AND c 16 | ) 17 | OR d 18 | 19 | 16: 20 | ---------------- 21 | SELECT 22 | a 23 | AND (b OR c) 24 | AND d, 25 | a 26 | OR (b AND c) 27 | OR d 28 | 29 | 45: 30 | --------------------------------------------- 31 | SELECT 32 | a AND (b OR c) AND d, a OR (b AND c) OR d 33 | 34 | 48: 35 | ------------------------------------------------ 36 | SELECT a AND (b OR c) AND d, a OR (b AND c) OR d 37 | 38 | 39 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/andor.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | a 7 | AND (b OR c) 8 | AND d, 9 | a 10 | OR (b AND c) 11 | OR d 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/andor.sql: -------------------------------------------------------------------------------- 1 | select a and (b or c) and d, 2 | a or (b and c) or d 3 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/backup.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | BACKUP 6 | DATABASE bank 7 | TO 'gs://acme-co-backup/database-bank-2017-03-29-nightly' 8 | AS OF SYSTEM TIME '-10s' 9 | INCREMENTAL FROM 'gs://acme-co-backup/database-bank-2017-03-27-weekly', 10 | 'gs://acme-co-backup/database-bank-2017-03-28-nightly' 11 | WITH revision_history 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/backup.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | BACKUP 6 | DATABASE bank 7 | TO 'gs://acme-co-backup/database-bank-2017-03-29-nightly' 8 | AS OF SYSTEM TIME '-10s' 9 | INCREMENTAL FROM 'gs://acme-co-backup/database-bank-2017-03-27-weekly', 10 | 'gs://acme-co-backup/database-bank-2017-03-28-nightly' 11 | WITH revision_history 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/backup.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | BACKUP 6 | DATABASE 7 | bank 8 | TO 9 | 'gs://acme-co-backup/database-bank-2017-03-29-nightly' 10 | AS OF SYSTEM TIME 11 | '-10s' 12 | INCREMENTAL FROM 13 | 'gs://acme-co-backup/database-bank-2017-03-27-weekly', 14 | 'gs://acme-co-backup/database-bank-2017-03-28-nightly' 15 | WITH 16 | revision_history 17 | 18 | 19 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/backup.sql: -------------------------------------------------------------------------------- 1 | BACKUP 2 | DATABASE bank TO 'gs://acme-co-backup/database-bank-2017-03-29-nightly' 3 | AS OF SYSTEM TIME '-10s' 4 | INCREMENTAL FROM 'gs://acme-co-backup/database-bank-2017-03-27-weekly', 'gs://acme-co-backup/database-bank-2017-03-28-nightly' 5 | WITH revision_history 6 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/case.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | CASE 7 | WHEN 1 8 | THEN 2 9 | WHEN 3 10 | THEN 4 11 | ELSE NULL 12 | END 13 | 14 | 11: 15 | ----------- 16 | SELECT CASE 17 | WHEN 1 18 | THEN 2 19 | WHEN 3 20 | THEN 4 21 | ELSE NULL 22 | END 23 | 24 | 20: 25 | -------------------- 26 | SELECT CASE 27 | WHEN 1 THEN 2 28 | WHEN 3 THEN 4 29 | ELSE NULL 30 | END 31 | 32 | 53: 33 | ----------------------------------------------------- 34 | SELECT CASE WHEN 1 THEN 2 WHEN 3 THEN 4 ELSE NULL END 35 | 36 | 37 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/case.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT CASE 6 | WHEN 1 THEN 2 7 | WHEN 3 THEN 4 8 | ELSE NULL 9 | END 10 | 11 | 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/case.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | CASE 7 | WHEN 1 8 | THEN 2 9 | WHEN 3 10 | THEN 4 11 | ELSE NULL 12 | END 13 | 14 | 11: 15 | ----------- 16 | SELECT CASE 17 | WHEN 1 18 | THEN 2 19 | WHEN 3 20 | THEN 4 21 | ELSE NULL 22 | END 23 | 24 | 20: 25 | -------------------- 26 | SELECT CASE 27 | WHEN 1 THEN 2 28 | WHEN 3 THEN 4 29 | ELSE NULL 30 | END 31 | 32 | 53: 33 | ----------------------------------------------------- 34 | SELECT CASE WHEN 1 THEN 2 WHEN 3 THEN 4 ELSE NULL END 35 | 36 | 37 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/case.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT CASE 6 | WHEN 1 THEN 2 7 | WHEN 3 THEN 4 8 | ELSE NULL 9 | END 10 | 11 | 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/case.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | CASE 7 | WHEN 1 8 | THEN 2 9 | WHEN 3 10 | THEN 4 11 | ELSE NULL 12 | END 13 | 14 | 17: 15 | ----------------- 16 | SELECT 17 | CASE 18 | WHEN 1 THEN 2 19 | WHEN 3 THEN 4 20 | ELSE NULL 21 | END 22 | 23 | 50: 24 | -------------------------------------------------- 25 | SELECT 26 | CASE WHEN 1 THEN 2 WHEN 3 THEN 4 ELSE NULL END 27 | 28 | 53: 29 | ----------------------------------------------------- 30 | SELECT CASE WHEN 1 THEN 2 WHEN 3 THEN 4 ELSE NULL END 31 | 32 | 33 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/case.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | CASE 7 | WHEN 1 THEN 2 8 | WHEN 3 THEN 4 9 | ELSE NULL 10 | END 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/case.sql: -------------------------------------------------------------------------------- 1 | select CASE WHEN 1 THEN 2 WHEN 3 THEN 4 else null END 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/comparison.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1 = 1, 6 | (1 + 2) = (3 * foo(x)), 7 | x = y::INT8, 8 | y[123] = min(z), 9 | a = ANY (SELECT 123) 10 | 11 | 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/comparison.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 1 = 1, 6 | (1 + 2) = (3 * foo(x)), 7 | x = y::INT8, 8 | y[123] = min(z), 9 | a = ANY (SELECT 123) 10 | 11 | 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/comparison.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | 1 = 1, 7 | (1 + 2) = (3 * foo(x)), 8 | x = y::INT8, 9 | y[123] = min(z), 10 | a = ANY (SELECT 123) 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/comparison.sql: -------------------------------------------------------------------------------- 1 | select 2 | 1 = 1, 3 | (1 + 2) = (3 * foo(x)), 4 | ((x)) = (y::int), 5 | (y[123]) = (min(z)), 6 | (a) = any (select 123) 7 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_as.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | id 7 | ) AS 8 | VALUES 9 | ( 10 | 1 11 | ) 12 | 13 | 11: 14 | ----------- 15 | CREATE TABLE t ( 16 | id 17 | ) AS 18 | VALUES 19 | (1) 20 | 21 | 12: 22 | ------------ 23 | CREATE TABLE t ( 24 | id 25 | ) AS 26 | VALUES ( 27 | 1 28 | ) 29 | 30 | 14: 31 | -------------- 32 | CREATE TABLE t ( 33 | id 34 | ) AS 35 | VALUES (1) 36 | 37 | 16: 38 | ---------------- 39 | CREATE TABLE t ( 40 | id 41 | ) AS VALUES (1) 42 | 43 | 29: 44 | ----------------------------- 45 | CREATE TABLE t (id) AS VALUES 46 | (1) 47 | 48 | 31: 49 | ------------------------------- 50 | CREATE TABLE t (id) AS VALUES ( 51 | 1 52 | ) 53 | 54 | 33: 55 | --------------------------------- 56 | CREATE TABLE t (id) AS VALUES (1) 57 | 58 | 59 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_as.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t (id) AS VALUES (1) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_as.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | id 7 | ) AS 8 | VALUES 9 | ( 10 | 1 11 | ) 12 | 13 | 11: 14 | ----------- 15 | CREATE TABLE t ( 16 | id 17 | ) AS 18 | VALUES 19 | (1) 20 | 21 | 12: 22 | ------------ 23 | CREATE TABLE t ( 24 | id 25 | ) AS 26 | VALUES ( 27 | 1 28 | ) 29 | 30 | 14: 31 | -------------- 32 | CREATE TABLE t ( 33 | id 34 | ) AS 35 | VALUES (1) 36 | 37 | 16: 38 | ---------------- 39 | CREATE TABLE t ( 40 | id 41 | ) AS VALUES (1) 42 | 43 | 29: 44 | ----------------------------- 45 | CREATE TABLE t (id) AS VALUES 46 | (1) 47 | 48 | 31: 49 | ------------------------------- 50 | CREATE TABLE t (id) AS VALUES ( 51 | 1 52 | ) 53 | 54 | 33: 55 | --------------------------------- 56 | CREATE TABLE t (id) AS VALUES (1) 57 | 58 | 59 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_as.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t (id) AS VALUES (1) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_as.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | id 7 | ) AS 8 | VALUES 9 | ( 10 | 1 11 | ) 12 | 13 | 11: 14 | ----------- 15 | CREATE TABLE t ( 16 | id 17 | ) AS 18 | VALUES 19 | (1) 20 | 21 | 14: 22 | -------------- 23 | CREATE TABLE t ( 24 | id 25 | ) AS 26 | VALUES (1) 27 | 28 | 22: 29 | ---------------------- 30 | CREATE TABLE t (id) AS 31 | VALUES (1) 32 | 33 | 33: 34 | --------------------------------- 35 | CREATE TABLE t (id) AS VALUES (1) 36 | 37 | 38 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_as.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t (id) AS VALUES (1) 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_as.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE t (id) AS VALUES (1); 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_index_partition.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE INDEX foo_b_idx ON foo (b, c, d) 6 | PARTITION BY LIST ( 7 | b 8 | ) 9 | ( 10 | PARTITION baz 11 | VALUES IN ( 12 | 'baz' 13 | ), 14 | PARTITION default 15 | VALUES IN ( 16 | DEFAULT 17 | ) 18 | ) 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_index_partition.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE INDEX foo_b_idx ON foo (b, c, d) 6 | PARTITION BY LIST ( 7 | b 8 | ) 9 | ( 10 | PARTITION baz 11 | VALUES IN ( 12 | 'baz' 13 | ), 14 | PARTITION default 15 | VALUES IN ( 16 | DEFAULT 17 | ) 18 | ) 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_index_partition.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE INDEX foo_b_idx 6 | ON foo (b, c, d) 7 | PARTITION BY LIST (b) 8 | ( 9 | PARTITION baz 10 | VALUES IN ('baz'), 11 | PARTITION default 12 | VALUES IN (DEFAULT) 13 | ) 14 | 15 | 16 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_index_partition.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX foo_b_idx ON foo (b, c, d) PARTITION BY LIST (b) ( 2 | PARTITION baz VALUES IN ('baz'), 3 | PARTITION default VALUES IN (DEFAULT) 4 | ) 5 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_interleaved_drop.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | a 7 | INT8 8 | ) 9 | INTERLEAVE IN PARENT p2 ( 10 | i, 11 | test 12 | ) RESTRICT 13 | 14 | 10: 15 | ---------- 16 | CREATE TABLE t ( 17 | a INT8 18 | ) 19 | INTERLEAVE IN PARENT p2 ( 20 | i, 21 | test 22 | ) RESTRICT 23 | 24 | 16: 25 | ---------------- 26 | CREATE TABLE t ( 27 | a INT8 28 | ) INTERLEAVE IN PARENT p2 ( 29 | i, 30 | test 31 | ) RESTRICT 32 | 33 | 44: 34 | -------------------------------------------- 35 | CREATE TABLE t ( 36 | a INT8 37 | ) INTERLEAVE IN PARENT p2 (i, test) RESTRICT 38 | 39 | 49: 40 | ------------------------------------------------- 41 | CREATE TABLE t (a INT8) INTERLEAVE IN PARENT p2 ( 42 | i, 43 | test 44 | ) RESTRICT 45 | 46 | 66: 47 | ------------------------------------------------------------------ 48 | CREATE TABLE t (a INT8) INTERLEAVE IN PARENT p2 (i, test) RESTRICT 49 | 50 | 51 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_interleaved_drop.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | a INT8 7 | ) INTERLEAVE IN PARENT p2 ( 8 | i, 9 | test 10 | ) RESTRICT 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_interleaved_drop.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | a 7 | INT8 8 | ) 9 | INTERLEAVE IN PARENT p2 ( 10 | i, 11 | test 12 | ) RESTRICT 13 | 14 | 10: 15 | ---------- 16 | CREATE TABLE t ( 17 | a INT8 18 | ) 19 | INTERLEAVE IN PARENT p2 ( 20 | i, 21 | test 22 | ) RESTRICT 23 | 24 | 16: 25 | ---------------- 26 | CREATE TABLE t ( 27 | a INT8 28 | ) INTERLEAVE IN PARENT p2 ( 29 | i, 30 | test 31 | ) RESTRICT 32 | 33 | 44: 34 | -------------------------------------------- 35 | CREATE TABLE t ( 36 | a INT8 37 | ) INTERLEAVE IN PARENT p2 (i, test) RESTRICT 38 | 39 | 49: 40 | ------------------------------------------------- 41 | CREATE TABLE t (a INT8) INTERLEAVE IN PARENT p2 ( 42 | i, 43 | test 44 | ) RESTRICT 45 | 46 | 66: 47 | ------------------------------------------------------------------ 48 | CREATE TABLE t (a INT8) INTERLEAVE IN PARENT p2 (i, test) RESTRICT 49 | 50 | 51 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_interleaved_drop.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | a INT8 7 | ) INTERLEAVE IN PARENT p2 ( 8 | i, 9 | test 10 | ) RESTRICT 11 | 12 | 13 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_interleaved_drop.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t ( 6 | a 7 | INT8 8 | ) 9 | INTERLEAVE IN PARENT p2 ( 10 | i, 11 | test 12 | ) RESTRICT 13 | 14 | 10: 15 | ---------- 16 | CREATE TABLE t ( 17 | a INT8 18 | ) 19 | INTERLEAVE IN PARENT p2 ( 20 | i, 21 | test 22 | ) RESTRICT 23 | 24 | 23: 25 | ----------------------- 26 | CREATE TABLE t (a INT8) 27 | INTERLEAVE IN PARENT p2 ( 28 | i, 29 | test 30 | ) RESTRICT 31 | 32 | 46: 33 | ---------------------------------------------- 34 | CREATE TABLE t (a INT8) 35 | INTERLEAVE IN PARENT p2 (i, test) RESTRICT 36 | 37 | 66: 38 | ------------------------------------------------------------------ 39 | CREATE TABLE t (a INT8) INTERLEAVE IN PARENT p2 (i, test) RESTRICT 40 | 41 | 42 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_interleaved_drop.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE t (a INT8) 6 | INTERLEAVE IN PARENT p2 ( 7 | i, 8 | test 9 | ) RESTRICT 10 | 11 | 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_interleaved_drop.sql: -------------------------------------------------------------------------------- 1 | create table t (a int) interleave in parent p2 (i, "test") restrict 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_partition_list.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE students_by_list ( 6 | id SERIAL8, 7 | name STRING, 8 | email STRING, 9 | country STRING, 10 | expected_graduation_date DATE, 11 | PRIMARY KEY (country, id) 12 | ) PARTITION BY LIST (country) ( 13 | PARTITION north_america 14 | VALUES IN ( 15 | 'CA', 16 | 'US' 17 | ), 18 | PARTITION australia 19 | VALUES IN ( 20 | 'AU', 21 | 'NZ' 22 | ), 23 | PARTITION default 24 | VALUES IN ( 25 | DEFAULT 26 | ) 27 | ) 28 | 29 | 30 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_partition_list.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE students_by_list ( 6 | id SERIAL8, 7 | name STRING, 8 | email STRING, 9 | country STRING, 10 | expected_graduation_date DATE, 11 | PRIMARY KEY (country, id) 12 | ) PARTITION BY LIST (country) ( 13 | PARTITION north_america 14 | VALUES IN ( 15 | 'CA', 16 | 'US' 17 | ), 18 | PARTITION australia 19 | VALUES IN ( 20 | 'AU', 21 | 'NZ' 22 | ), 23 | PARTITION default 24 | VALUES IN ( 25 | DEFAULT 26 | ) 27 | ) 28 | 29 | 30 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_partition_list.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE students_by_list ( 6 | id 7 | SERIAL8, 8 | name 9 | STRING, 10 | email 11 | STRING, 12 | country 13 | STRING, 14 | expected_graduation_date 15 | DATE, 16 | PRIMARY KEY (country, id) 17 | ) 18 | PARTITION BY LIST (country) 19 | ( 20 | PARTITION north_america 21 | VALUES IN ('CA', 'US'), 22 | PARTITION australia 23 | VALUES IN ('AU', 'NZ'), 24 | PARTITION default 25 | VALUES IN (DEFAULT) 26 | ) 27 | 28 | 29 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_partition_list.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE students_by_list ( 2 | id SERIAL, 3 | name STRING, 4 | email STRING, 5 | country STRING, 6 | expected_graduation_date DATE, 7 | PRIMARY KEY (country, id)) 8 | PARTITION BY LIST (country) 9 | (PARTITION north_america VALUES IN ('CA','US'), 10 | PARTITION australia VALUES IN ('AU','NZ'), 11 | PARTITION DEFAULT VALUES IN (default)) 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_partition_range.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE students_by_range ( 6 | id SERIAL8, 7 | name STRING, 8 | email STRING, 9 | country STRING, 10 | expected_graduation_date DATE, 11 | PRIMARY KEY ( 12 | expected_graduation_date, 13 | id 14 | ) 15 | ) PARTITION BY RANGE ( 16 | expected_graduation_date 17 | ) ( 18 | PARTITION graduated 19 | VALUES FROM (minvalue) 20 | TO ('2017-08-15'), 21 | PARTITION current VALUES FROM ( 22 | '2017-08-15' 23 | ) 24 | TO (maxvalue) 25 | ) 26 | 27 | 28 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_partition_range.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE students_by_range ( 6 | id SERIAL8, 7 | name STRING, 8 | email STRING, 9 | country STRING, 10 | expected_graduation_date DATE, 11 | PRIMARY KEY ( 12 | expected_graduation_date, 13 | id 14 | ) 15 | ) PARTITION BY RANGE ( 16 | expected_graduation_date 17 | ) ( 18 | PARTITION graduated 19 | VALUES FROM (minvalue) 20 | TO ('2017-08-15'), 21 | PARTITION current VALUES FROM ( 22 | '2017-08-15' 23 | ) 24 | TO (maxvalue) 25 | ) 26 | 27 | 28 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_partition_range.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE TABLE students_by_range ( 6 | id 7 | SERIAL8, 8 | name 9 | STRING, 10 | email 11 | STRING, 12 | country 13 | STRING, 14 | expected_graduation_date 15 | DATE, 16 | PRIMARY KEY ( 17 | expected_graduation_date, 18 | id 19 | ) 20 | ) 21 | PARTITION BY RANGE ( 22 | expected_graduation_date 23 | ) 24 | ( 25 | PARTITION graduated 26 | VALUES FROM (minvalue) 27 | TO ('2017-08-15'), 28 | PARTITION current 29 | VALUES FROM ( 30 | '2017-08-15' 31 | ) 32 | TO (maxvalue) 33 | ) 34 | 35 | 36 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_partition_range.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE students_by_range ( 2 | id SERIAL, 3 | name STRING, 4 | email STRING, 5 | country STRING, 6 | expected_graduation_date DATE, 7 | PRIMARY KEY (expected_graduation_date, id)) 8 | PARTITION BY RANGE (expected_graduation_date) 9 | (PARTITION graduated VALUES FROM (MINVALUE) TO ('2017-08-15'), 10 | PARTITION current VALUES FROM ('2017-08-15') TO (MAXVALUE)) 11 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_subpartition.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE students ( 2 | id SERIAL, 3 | name STRING, 4 | email STRING, 5 | country STRING, 6 | expected_graduation_date DATE, 7 | PRIMARY KEY (country, expected_graduation_date, id)) 8 | PARTITION BY LIST (country)( 9 | PARTITION australia VALUES IN ('AU','NZ') PARTITION BY RANGE (expected_graduation_date)(PARTITION graduated_au VALUES FROM (MINVALUE) TO ('2017-08-15'), PARTITION current_au VALUES FROM ('2017-08-15') TO (MAXVALUE)), 10 | PARTITION north_america VALUES IN ('US','CA') PARTITION BY RANGE (expected_graduation_date)(PARTITION graduated_us VALUES FROM (MINVALUE) TO ('2017-08-15'), PARTITION current_us VALUES FROM ('2017-08-15') TO (MAXVALUE)) 11 | ) 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_view.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE VIEW startrek.quotes_per_season ( 6 | season, 7 | quotes 8 | ) AS SELECT startrek.episodes.season, 9 | count(*) 10 | FROM startrek.quotes 11 | JOIN startrek.episodes ON 12 | startrek.quotes.episode 13 | = startrek.episodes.id 14 | GROUP BY startrek.episodes.season 15 | 16 | 17 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_view.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE VIEW startrek.quotes_per_season ( 6 | season, 7 | quotes 8 | ) AS SELECT startrek.episodes.season, 9 | count(*) 10 | FROM startrek.quotes 11 | JOIN startrek.episodes ON 12 | startrek.quotes.episode 13 | = startrek.episodes.id 14 | GROUP BY startrek.episodes.season 15 | 16 | 17 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_view.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | CREATE VIEW startrek.quotes_per_season ( 6 | season, 7 | quotes 8 | ) AS 9 | SELECT 10 | startrek.episodes.season, 11 | count(*) 12 | FROM 13 | startrek.quotes 14 | JOIN startrek.episodes ON 15 | startrek.quotes.episode 16 | = startrek.episodes.id 17 | GROUP BY 18 | startrek.episodes.season 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/create_view.sql: -------------------------------------------------------------------------------- 1 | CREATE VIEW startrek.quotes_per_season (season, quotes) 2 | AS SELECT startrek.episodes.season, count(*) 3 | FROM startrek.quotes 4 | JOIN startrek.episodes 5 | ON startrek.quotes.episode = startrek.episodes.id 6 | GROUP BY startrek.episodes.season 7 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT "Level", "Type" 6 | FROM [ 7 | EXPLAIN (VERBOSE) SELECT * 8 | FROM kv 9 | AS a 10 | JOIN kv USING (k) 11 | WHERE a.v 12 | > 3 13 | ORDER BY a.v 14 | DESC 15 | ] 16 | 17 | 18 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT "Level", "Type" 6 | FROM [ 7 | EXPLAIN (VERBOSE) SELECT * 8 | FROM kv 9 | AS a 10 | JOIN kv USING (k) 11 | WHERE a.v 12 | > 3 13 | ORDER BY a.v 14 | DESC 15 | ] 16 | 17 | 18 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | "Level", "Type" 7 | FROM 8 | [ 9 | EXPLAIN (VERBOSE) 10 | SELECT 11 | * 12 | FROM 13 | kv AS a 14 | JOIN kv USING (k) 15 | WHERE 16 | a.v > 3 17 | ORDER BY 18 | a.v DESC 19 | ] 20 | 21 | 22 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain.sql: -------------------------------------------------------------------------------- 1 | SELECT "Level", "Type" FROM [EXPLAIN (VERBOSE) SELECT * FROM kv AS a JOIN kv USING (k) WHERE a.v > 3 ORDER BY a.v DESC] 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain_analyze.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | EXPLAIN ANALYZE ( 6 | DISTSQL 7 | ) 8 | DROP TABLE a 9 | 10 | 17: 11 | ----------------- 12 | EXPLAIN ANALYZE ( 13 | DISTSQL 14 | ) DROP TABLE a 15 | 16 | 38: 17 | -------------------------------------- 18 | EXPLAIN ANALYZE (DISTSQL) DROP TABLE a 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain_analyze.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | EXPLAIN ANALYZE (DISTSQL) DROP TABLE a 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain_analyze.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | EXPLAIN ANALYZE ( 6 | DISTSQL 7 | ) 8 | DROP TABLE a 9 | 10 | 17: 11 | ----------------- 12 | EXPLAIN ANALYZE ( 13 | DISTSQL 14 | ) DROP TABLE a 15 | 16 | 38: 17 | -------------------------------------- 18 | EXPLAIN ANALYZE (DISTSQL) DROP TABLE a 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain_analyze.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | EXPLAIN ANALYZE (DISTSQL) DROP TABLE a 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain_analyze.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | EXPLAIN ANALYZE ( 6 | DISTSQL 7 | ) 8 | DROP TABLE a 9 | 10 | 25: 11 | ------------------------- 12 | EXPLAIN ANALYZE (DISTSQL) 13 | DROP TABLE a 14 | 15 | 38: 16 | -------------------------------------- 17 | EXPLAIN ANALYZE (DISTSQL) DROP TABLE a 18 | 19 | 20 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain_analyze.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | EXPLAIN ANALYZE (DISTSQL) DROP TABLE a 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/explain_analyze.sql: -------------------------------------------------------------------------------- 1 | EXPLAIN ANALYZE (DISTSQL) DROP TABLE a 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/export.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | EXPORT 6 | INTO CSV 'azure://acme-co/customer-export-data?AZURE_ACCOUNT_KEY=hash&AZURE_ACCOUNT_NAME=acme-co' 7 | FROM SELECT * 8 | FROM bank.customers 9 | WHERE id >= 100 10 | 11 | 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/export.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | EXPORT 6 | INTO CSV 'azure://acme-co/customer-export-data?AZURE_ACCOUNT_KEY=hash&AZURE_ACCOUNT_NAME=acme-co' 7 | FROM SELECT * 8 | FROM bank.customers 9 | WHERE id >= 100 10 | 11 | 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/export.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | EXPORT 6 | INTO CSV 7 | 'azure://acme-co/customer-export-data?AZURE_ACCOUNT_KEY=hash&AZURE_ACCOUNT_NAME=acme-co' 8 | FROM 9 | SELECT 10 | * 11 | FROM 12 | bank.customers 13 | WHERE 14 | id >= 100 15 | 16 | 17 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/export.sql: -------------------------------------------------------------------------------- 1 | EXPORT INTO CSV 2 | 'azure://acme-co/customer-export-data?AZURE_ACCOUNT_KEY=hash&AZURE_ACCOUNT_NAME=acme-co' 3 | FROM SELECT * FROM bank.customers WHERE id >= 100 4 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/functions.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT min(a, b), 6 | min(a ORDER BY b), 7 | min(a ORDER BY b, c), 8 | min(a ORDER BY b, c, d), 9 | min(DISTINCT a, b), 10 | min(), 11 | min() OVER (), 12 | min() OVER (ORDER BY x), 13 | min() FILTER ( 14 | WHERE x > 3 AND y < 4 15 | ), 16 | min() FILTER ( 17 | WHERE x > 3 AND y < 4 18 | ) OVER (ORDER BY x), 19 | min() OVER ( 20 | RANGE BETWEEN 21 | UNBOUNDED PRECEDING 22 | AND 23 | UNBOUNDED FOLLOWING 24 | ), 25 | min() OVER ( 26 | ROWS BETWEEN 1 FOLLOWING 27 | AND 1 FOLLOWING 28 | ), 29 | min() OVER ( 30 | w 31 | PARTITION BY a, b 32 | ORDER BY x, y 33 | ROWS BETWEEN 1 FOLLOWING 34 | AND 1 FOLLOWING 35 | ) 36 | 37 | 38 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/functions.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT min(a, b), 6 | min(a ORDER BY b), 7 | min(a ORDER BY b, c), 8 | min(a ORDER BY b, c, d), 9 | min(DISTINCT a, b), 10 | min(), 11 | min() OVER (), 12 | min() OVER (ORDER BY x), 13 | min() FILTER ( 14 | WHERE x > 3 AND y < 4 15 | ), 16 | min() FILTER ( 17 | WHERE x > 3 AND y < 4 18 | ) OVER (ORDER BY x), 19 | min() OVER ( 20 | RANGE BETWEEN 21 | UNBOUNDED PRECEDING 22 | AND 23 | UNBOUNDED FOLLOWING 24 | ), 25 | min() OVER ( 26 | ROWS BETWEEN 1 FOLLOWING 27 | AND 1 FOLLOWING 28 | ), 29 | min() OVER ( 30 | w 31 | PARTITION BY a, b 32 | ORDER BY x, y 33 | ROWS BETWEEN 1 FOLLOWING 34 | AND 1 FOLLOWING 35 | ) 36 | 37 | 38 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/functions.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | min(a, b), 7 | min(a ORDER BY b), 8 | min(a ORDER BY b, c), 9 | min(a ORDER BY b, c, d), 10 | min(DISTINCT a, b), 11 | min(), 12 | min() OVER (), 13 | min() OVER (ORDER BY x), 14 | min() FILTER ( 15 | WHERE x > 3 AND y < 4 16 | ), 17 | min() FILTER ( 18 | WHERE x > 3 AND y < 4 19 | ) OVER (ORDER BY x), 20 | min() OVER ( 21 | RANGE 22 | BETWEEN 23 | UNBOUNDED PRECEDING 24 | AND 25 | UNBOUNDED FOLLOWING 26 | ), 27 | min() OVER ( 28 | ROWS 29 | BETWEEN 30 | 1 FOLLOWING 31 | AND 32 | 1 FOLLOWING 33 | ), 34 | min() OVER ( 35 | w 36 | PARTITION BY 37 | a, b 38 | ORDER BY 39 | x, y 40 | ROWS 41 | BETWEEN 42 | 1 FOLLOWING 43 | AND 44 | 1 FOLLOWING 45 | ) 46 | 47 | 48 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/functions.sql: -------------------------------------------------------------------------------- 1 | select 2 | min(a,b), 3 | min(a order by b), 4 | min(a order by b, c), 5 | min(a order by b, c, d), 6 | min(distinct a,b), 7 | min(), 8 | min() over (), 9 | min() over (order by x), 10 | min() filter (where x >3 and y < 4), 11 | min() filter (where x >3 and y < 4) over (order by x), 12 | min() over (range between unbounded preceding and unbounded following), 13 | min() over (rows between 1 following and 1 following), 14 | min() over (w partition by a,b order by x,y rows between 1 following and 1 following) 15 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import1.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t 8 | FROM 9 | CSV 10 | $1 11 | 12 | 6: 13 | ------ 14 | IMPORT 15 | TABLE t 16 | FROM 17 | CSV $1 18 | 19 | 26: 20 | -------------------------- 21 | IMPORT TABLE t FROM CSV $1 22 | 23 | 24 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import1.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT TABLE t FROM CSV $1 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import1.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t 8 | FROM 9 | CSV 10 | $1 11 | 12 | 6: 13 | ------ 14 | IMPORT 15 | TABLE t 16 | FROM 17 | CSV $1 18 | 19 | 26: 20 | -------------------------- 21 | IMPORT TABLE t FROM CSV $1 22 | 23 | 24 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import1.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT TABLE t FROM CSV $1 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import1.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t 8 | FROM 9 | CSV 10 | $1 11 | 12 | 26: 13 | -------------------------- 14 | IMPORT TABLE t FROM CSV $1 15 | 16 | 17 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import1.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT TABLE t FROM CSV $1 6 | 7 | 8 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import1.sql: -------------------------------------------------------------------------------- 1 | import table t from csv $1 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import2.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | PGDUMP 7 | 'http://test' 8 | WITH 9 | skip = '2', 10 | sstsize = '30MB' 11 | 12 | 6: 13 | ------ 14 | IMPORT 15 | PGDUMP 'http://test' 16 | WITH skip = '2', 17 | sstsize = '30MB' 18 | 19 | 35: 20 | ----------------------------------- 21 | IMPORT 22 | PGDUMP 'http://test' 23 | WITH skip = '2', sstsize = '30MB' 24 | 25 | 61: 26 | ------------------------------------------------------------- 27 | IMPORT PGDUMP 'http://test' WITH skip = '2', sstsize = '30MB' 28 | 29 | 30 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import2.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | PGDUMP 'http://test' 7 | WITH skip = '2', sstsize = '30MB' 8 | 9 | 10 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import2.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | PGDUMP 7 | 'http://test' 8 | WITH 9 | skip = '2', 10 | sstsize = '30MB' 11 | 12 | 6: 13 | ------ 14 | IMPORT 15 | PGDUMP 'http://test' 16 | WITH skip = '2', 17 | sstsize = '30MB' 18 | 19 | 35: 20 | ----------------------------------- 21 | IMPORT 22 | PGDUMP 'http://test' 23 | WITH skip = '2', sstsize = '30MB' 24 | 25 | 61: 26 | ------------------------------------------------------------- 27 | IMPORT PGDUMP 'http://test' WITH skip = '2', sstsize = '30MB' 28 | 29 | 30 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import2.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | PGDUMP 'http://test' 7 | WITH skip = '2', sstsize = '30MB' 8 | 9 | 10 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import2.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | PGDUMP 7 | 'http://test' 8 | WITH 9 | skip = '2', 10 | sstsize = '30MB' 11 | 12 | 32: 13 | -------------------------------- 14 | IMPORT 15 | PGDUMP 16 | 'http://test' 17 | WITH 18 | skip = '2', sstsize = '30MB' 19 | 20 | 61: 21 | ------------------------------------------------------------- 22 | IMPORT PGDUMP 'http://test' WITH skip = '2', sstsize = '30MB' 23 | 24 | 25 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import2.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | PGDUMP 7 | 'http://test' 8 | WITH 9 | skip = '2', sstsize = '30MB' 10 | 11 | 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import2.sql: -------------------------------------------------------------------------------- 1 | import pgdump 'http://test' with skip = '2', sstsize = '30MB' 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import3.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t 8 | CREATE USING 9 | 'http://test' 10 | CSV 11 | DATA ( 12 | $1, 13 | 'http://csv' 14 | ) 15 | 16 | 12: 17 | ------------ 18 | IMPORT 19 | TABLE t 20 | CREATE USING 'http://test' 21 | CSV DATA ( 22 | $1, 23 | 'http://csv' 24 | ) 25 | 26 | 36: 27 | ------------------------------------ 28 | IMPORT 29 | TABLE t 30 | CREATE USING 'http://test' 31 | CSV DATA ($1, 'http://csv') 32 | 33 | 69: 34 | --------------------------------------------------------------------- 35 | IMPORT TABLE t CREATE USING 'http://test' CSV DATA ($1, 'http://csv') 36 | 37 | 38 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import3.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE t 7 | CREATE USING 'http://test' 8 | CSV DATA ($1, 'http://csv') 9 | 10 | 11 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import3.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t 8 | CREATE USING 9 | 'http://test' 10 | CSV 11 | DATA ( 12 | $1, 13 | 'http://csv' 14 | ) 15 | 16 | 12: 17 | ------------ 18 | IMPORT 19 | TABLE t 20 | CREATE USING 'http://test' 21 | CSV DATA ( 22 | $1, 23 | 'http://csv' 24 | ) 25 | 26 | 36: 27 | ------------------------------------ 28 | IMPORT 29 | TABLE t 30 | CREATE USING 'http://test' 31 | CSV DATA ($1, 'http://csv') 32 | 33 | 69: 34 | --------------------------------------------------------------------- 35 | IMPORT TABLE t CREATE USING 'http://test' CSV DATA ($1, 'http://csv') 36 | 37 | 38 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import3.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE t 7 | CREATE USING 'http://test' 8 | CSV DATA ($1, 'http://csv') 9 | 10 | 11 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import3.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t 8 | CREATE USING 9 | 'http://test' 10 | CSV 11 | DATA ( 12 | $1, 13 | 'http://csv' 14 | ) 15 | 16 | 27: 17 | --------------------------- 18 | IMPORT 19 | TABLE 20 | t 21 | CREATE USING 22 | 'http://test' 23 | CSV 24 | DATA ($1, 'http://csv') 25 | 26 | 69: 27 | --------------------------------------------------------------------- 28 | IMPORT TABLE t CREATE USING 'http://test' CSV DATA ($1, 'http://csv') 29 | 30 | 31 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import3.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t 8 | CREATE USING 9 | 'http://test' 10 | CSV 11 | DATA ($1, 'http://csv') 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import3.sql: -------------------------------------------------------------------------------- 1 | import table t create using 'http://test' csv data ($1, 'http://csv') 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import4.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t ( 8 | i 9 | INT8, 10 | s 11 | STRING 12 | ) 13 | CSV 14 | DATA ( 15 | $1 16 | ) 17 | 18 | 6: 19 | ------ 20 | IMPORT 21 | TABLE t ( 22 | i 23 | INT8, 24 | s 25 | STRING 26 | ) 27 | CSV DATA ( 28 | $1 29 | ) 30 | 31 | 15: 32 | --------------- 33 | IMPORT 34 | TABLE t ( 35 | i INT8, 36 | s STRING 37 | ) 38 | CSV DATA ( 39 | $1 40 | ) 41 | 42 | 16: 43 | ---------------- 44 | IMPORT 45 | TABLE t ( 46 | i INT8, 47 | s STRING 48 | ) 49 | CSV DATA ($1) 50 | 51 | 24: 52 | ------------------------ 53 | IMPORT 54 | TABLE t ( 55 | i INT8, s STRING 56 | ) 57 | CSV DATA ($1) 58 | 59 | 27: 60 | --------------------------- 61 | IMPORT 62 | TABLE t (i INT8, s STRING) 63 | CSV DATA ($1) 64 | 65 | 47: 66 | ----------------------------------------------- 67 | IMPORT TABLE t (i INT8, s STRING) CSV DATA ($1) 68 | 69 | 70 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import4.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE t (i INT8, s STRING) 7 | CSV DATA ($1) 8 | 9 | 10 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import4.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t ( 8 | i 9 | INT8, 10 | s 11 | STRING 12 | ) 13 | CSV 14 | DATA ( 15 | $1 16 | ) 17 | 18 | 6: 19 | ------ 20 | IMPORT 21 | TABLE t ( 22 | i 23 | INT8, 24 | s 25 | STRING 26 | ) 27 | CSV DATA ( 28 | $1 29 | ) 30 | 31 | 15: 32 | --------------- 33 | IMPORT 34 | TABLE t ( 35 | i INT8, 36 | s STRING 37 | ) 38 | CSV DATA ( 39 | $1 40 | ) 41 | 42 | 16: 43 | ---------------- 44 | IMPORT 45 | TABLE t ( 46 | i INT8, 47 | s STRING 48 | ) 49 | CSV DATA ($1) 50 | 51 | 24: 52 | ------------------------ 53 | IMPORT 54 | TABLE t ( 55 | i INT8, s STRING 56 | ) 57 | CSV DATA ($1) 58 | 59 | 27: 60 | --------------------------- 61 | IMPORT 62 | TABLE t (i INT8, s STRING) 63 | CSV DATA ($1) 64 | 65 | 47: 66 | ----------------------------------------------- 67 | IMPORT TABLE t (i INT8, s STRING) CSV DATA ($1) 68 | 69 | 70 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import4.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE t (i INT8, s STRING) 7 | CSV DATA ($1) 8 | 9 | 10 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import4.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t ( 8 | i 9 | INT8, 10 | s 11 | STRING 12 | ) 13 | CSV 14 | DATA ( 15 | $1 16 | ) 17 | 18 | 13: 19 | ------------- 20 | IMPORT 21 | TABLE 22 | t ( 23 | i 24 | INT8, 25 | s 26 | STRING 27 | ) 28 | CSV 29 | DATA ($1) 30 | 31 | 24: 32 | ------------------------ 33 | IMPORT 34 | TABLE 35 | t (i INT8, s STRING) 36 | CSV 37 | DATA ($1) 38 | 39 | 47: 40 | ----------------------------------------------- 41 | IMPORT TABLE t (i INT8, s STRING) CSV DATA ($1) 42 | 43 | 44 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import4.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | IMPORT 6 | TABLE 7 | t (i INT8, s STRING) 8 | CSV 9 | DATA ($1) 10 | 11 | 12 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/import4.sql: -------------------------------------------------------------------------------- 1 | import table t (i int, s string) csv data ($1) 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join2.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | NULL AS table_cat, 7 | n.nspname AS table_schem, 8 | ct.relname AS table_name, 9 | a.attname AS column_name, 10 | (i.keys).n AS key_seq, 11 | ci.relname AS pk_name 12 | FROM 13 | pg_catalog.pg_class AS ct 14 | JOIN pg_catalog.pg_attribute AS a ON 15 | ct.oid = a.attrelid 16 | JOIN pg_catalog.pg_namespace AS n ON 17 | ct.relnamespace = n.oid 18 | JOIN ( 19 | SELECT 20 | i.indexrelid, 21 | i.indrelid, 22 | i.indisprimary, 23 | information_schema._pg_expandarray( 24 | i.indkey 25 | ) 26 | AS keys 27 | FROM 28 | pg_catalog.pg_index AS i 29 | ) 30 | AS i ON 31 | a.attnum = (i.keys).x 32 | AND a.attrelid = i.indrelid 33 | JOIN pg_catalog.pg_class AS ci ON 34 | ci.oid = i.indexrelid 35 | WHERE 36 | true 37 | AND ct.relname = 'j' 38 | AND i.indisprimary 39 | ORDER BY 40 | table_name, pk_name, key_seq 41 | 42 | 43 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join2.sql: -------------------------------------------------------------------------------- 1 | SELECT NULL AS TABLE_CAT, 2 | n.nspname AS TABLE_SCHEM, 3 | ct.relname AS TABLE_NAME, 4 | a.attname AS COLUMN_NAME, 5 | (i.keys).n AS KEY_SEQ, 6 | ci.relname AS PK_NAME 7 | FROM pg_catalog.pg_class ct 8 | JOIN pg_catalog.pg_attribute a ON (ct.oid = a.attrelid) 9 | JOIN pg_catalog.pg_namespace n ON (ct.relnamespace = n.oid) 10 | JOIN (SELECT i.indexrelid, 11 | i.indrelid, 12 | i.indisprimary, 13 | information_schema._pg_expandarray(i.indkey) AS keys 14 | FROM pg_catalog.pg_index i) i ON (a.attnum = (i.keys).x AND a.attrelid = i.indrelid) 15 | JOIN pg_catalog.pg_class ci ON (ci.oid = i.indexrelid) 16 | WHERE true AND ct.relname = 'j' AND i.indisprimary 17 | ORDER BY table_name, pk_name, key_seq 18 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join4.align-deindent.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | * 7 | FROM 8 | a 9 | JOIN b USING (c), 10 | a 11 | NATURAL JOIN b, 12 | a 13 | JOIN b ON 14 | c 15 | WHERE 16 | true 17 | 18 | 8: 19 | -------- 20 | SELECT * 21 | FROM a 22 | JOIN b USING (c), 23 | a 24 | NATURAL JOIN b, 25 | a 26 | JOIN b ON 27 | c 28 | WHERE true 29 | 30 | 13: 31 | ------------- 32 | SELECT * 33 | FROM a 34 | JOIN b USING (c), 35 | a 36 | NATURAL JOIN b, 37 | a 38 | JOIN b ON c 39 | WHERE true 40 | 41 | 58: 42 | ---------------------------------------------------------- 43 | SELECT * 44 | FROM a JOIN b USING (c), a NATURAL JOIN b, a JOIN b ON c 45 | WHERE true 46 | 47 | 76: 48 | ---------------------------------------------------------------------------- 49 | SELECT * FROM a JOIN b USING (c), a NATURAL JOIN b, a JOIN b ON c WHERE true 50 | 51 | 52 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join4.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT * 6 | FROM a 7 | JOIN b USING (c), 8 | a 9 | NATURAL JOIN b, 10 | a 11 | JOIN b ON c 12 | WHERE true 13 | 14 | 15 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join4.align-only.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | * 7 | FROM 8 | a 9 | JOIN b USING (c), 10 | a 11 | NATURAL JOIN b, 12 | a 13 | JOIN b ON 14 | c 15 | WHERE 16 | true 17 | 18 | 8: 19 | -------- 20 | SELECT * 21 | FROM a 22 | JOIN b USING (c), 23 | a 24 | NATURAL JOIN b, 25 | a 26 | JOIN b ON 27 | c 28 | WHERE true 29 | 30 | 18: 31 | ------------------ 32 | SELECT * 33 | FROM a 34 | JOIN b USING (c), 35 | a 36 | NATURAL JOIN b, 37 | a 38 | JOIN b ON c 39 | WHERE true 40 | 41 | 58: 42 | ---------------------------------------------------------- 43 | SELECT * 44 | FROM a JOIN b USING (c), a NATURAL JOIN b, a JOIN b ON c 45 | WHERE true 46 | 47 | 76: 48 | ---------------------------------------------------------------------------- 49 | SELECT * FROM a JOIN b USING (c), a NATURAL JOIN b, a JOIN b ON c WHERE true 50 | 51 | 52 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join4.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT * 6 | FROM a 7 | JOIN b USING (c), 8 | a 9 | NATURAL JOIN b, 10 | a 11 | JOIN b ON c 12 | WHERE true 13 | 14 | 15 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join4.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | * 7 | FROM 8 | a 9 | JOIN b USING (c), 10 | a 11 | NATURAL JOIN b, 12 | a 13 | JOIN b ON 14 | c 15 | WHERE 16 | true 17 | 18 | 15: 19 | --------------- 20 | SELECT 21 | * 22 | FROM 23 | a 24 | JOIN b USING (c), 25 | a 26 | NATURAL JOIN b, 27 | a 28 | JOIN b ON c 29 | WHERE 30 | true 31 | 32 | 55: 33 | ------------------------------------------------------- 34 | SELECT 35 | * 36 | FROM 37 | a JOIN b USING (c), a NATURAL JOIN b, a JOIN b ON c 38 | WHERE 39 | true 40 | 41 | 76: 42 | ---------------------------------------------------------------------------- 43 | SELECT * FROM a JOIN b USING (c), a NATURAL JOIN b, a JOIN b ON c WHERE true 44 | 45 | 46 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join4.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | * 7 | FROM 8 | a 9 | JOIN b USING (c), 10 | a 11 | NATURAL JOIN b, 12 | a 13 | JOIN b ON c 14 | WHERE 15 | true 16 | 17 | 18 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join4.sql: -------------------------------------------------------------------------------- 1 | select * from 2 | a join b using(c), 3 | a natural join b, 4 | a join b on (c) 5 | where true 6 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join5.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT * 6 | FROM a 7 | CROSS JOIN b, 8 | a 9 | CROSS JOIN (c CROSS JOIN d), 10 | d, 11 | (TABLE x), 12 | (TABLE e ORDER BY f) 13 | 14 | 15 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join5.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT * 6 | FROM a 7 | CROSS JOIN b, 8 | a 9 | CROSS JOIN (c CROSS JOIN d), 10 | d, 11 | (TABLE x), 12 | (TABLE e ORDER BY f) 13 | 14 | 15 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join5.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | * 7 | FROM 8 | a 9 | CROSS JOIN b, 10 | a 11 | CROSS JOIN (c CROSS JOIN d), 12 | d, 13 | (TABLE x), 14 | (TABLE e ORDER BY f) 15 | 16 | 17 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/join5.sql: -------------------------------------------------------------------------------- 1 | select * from 2 | (a cross join b), 3 | (a cross join (c cross join d)), 4 | d, 5 | (table x), 6 | (table e order by f) 7 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/json.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT ' 6 | [ 7 | 1, 8 | "a", 9 | true, 10 | null, 11 | {"c": "blah", "d": []} 12 | ] 13 | ':::JSONB, 14 | ' 15 | {"\n": ["\""], "\"": "\\"} 16 | '::JSONB 17 | 18 | 19 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/json.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT ' 6 | [ 7 | 1, 8 | "a", 9 | true, 10 | null, 11 | {"c": "blah", "d": []} 12 | ] 13 | ':::JSONB, 14 | ' 15 | {"\n": ["\""], "\"": "\\"} 16 | '::JSONB 17 | 18 | 19 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/json.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | ' 7 | [ 8 | 1, 9 | "a", 10 | true, 11 | null, 12 | {"c": "blah", "d": []} 13 | ] 14 | ':::JSONB, 15 | '{"\n": ["\""], "\"": "\\"}'::JSONB 16 | 17 | 18 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/json.sql: -------------------------------------------------------------------------------- 1 | select '[1, "a", true, null, {"c": "blah", "d": []}]':::JSON, '{"\n": ["\""], "\"": "\\"}'::JSONB -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/precedence.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT a + b - c, 6 | a - b + c, 7 | a + b - c, 8 | a - (b + c), 9 | a + b - c + d, 10 | a - b + c + d, 11 | a + b - c + d, 12 | a - (b + c) + d, 13 | a + b - c - d, 14 | a - b + c - d, 15 | a + b - c - d, 16 | a - (b + c) - d, 17 | d + a + b - c, 18 | d + a - b + c, 19 | d + a + b - c, 20 | d + a - (b + c), 21 | d - (a + b - c), 22 | d - (a - b + c), 23 | d - (a + b - c), 24 | d - (a - (b + c)), 25 | a1 / a2 / (b / c) / (d / e / f), 26 | (a + b) * c * d, 27 | a + b * c, 28 | (a + b) * c 29 | 30 | 31 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/precedence.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT a + b - c, 6 | a - b + c, 7 | a + b - c, 8 | a - (b + c), 9 | a + b - c + d, 10 | a - b + c + d, 11 | a + b - c + d, 12 | a - (b + c) + d, 13 | a + b - c - d, 14 | a - b + c - d, 15 | a + b - c - d, 16 | a - (b + c) - d, 17 | d + a + b - c, 18 | d + a - b + c, 19 | d + a + b - c, 20 | d + a - (b + c), 21 | d - (a + b - c), 22 | d - (a - b + c), 23 | d - (a + b - c), 24 | d - (a - (b + c)), 25 | a1 / a2 / (b / c) / (d / e / f), 26 | (a + b) * c * d, 27 | a + b * c, 28 | (a + b) * c 29 | 30 | 31 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/precedence.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | a + b - c, 7 | a - b + c, 8 | a + b - c, 9 | a - (b + c), 10 | a + b - c + d, 11 | a - b + c + d, 12 | a + b - c + d, 13 | a - (b + c) + d, 14 | a + b - c - d, 15 | a - b + c - d, 16 | a + b - c - d, 17 | a - (b + c) - d, 18 | d + a + b - c, 19 | d + a - b + c, 20 | d + a + b - c, 21 | d + a - (b + c), 22 | d - (a + b - c), 23 | d - (a - b + c), 24 | d - (a + b - c), 25 | d - (a - (b + c)), 26 | a1 / a2 / (b / c) / (d / e / f), 27 | (a + b) * c * d, 28 | a + b * c, 29 | (a + b) * c 30 | 31 | 32 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/precedence.sql: -------------------------------------------------------------------------------- 1 | select 2 | (a + b) - c, (a - b) + c, -- verify associativity at top 3 | a + (b - c), a - (b + c), -- ditto 4 | ((a + b) - c) + d, ((a - b) + c) + d, -- veriffy associativity in sub-expr 5 | (a + (b - c)) + d, (a - (b + c)) + d, -- ditto 6 | ((a + b) - c) - d, ((a - b) + c) - d, -- ditto 7 | (a + (b - c)) - d, (a - (b + c)) - d, -- ditto 8 | d + ((a + b) - c), d + ((a - b) + c), -- ditto 9 | d + (a + (b - c)), d + (a - (b + c)), -- ditto 10 | d - ((a + b) - c), d - ((a - b) + c), -- ditto 11 | d - (a + (b - c)), d - (a - (b + c)), -- ditto 12 | ((a1/a2)/(b/c))/((d/e)/f), -- ditto 13 | (a+b)*(c*d), -- mixed precedence 14 | a+(b*c), (a+b)*c -- ditto 15 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/restore.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | RESTORE 6 | TABLE bank.customers 7 | FROM 'gs://acme-co-backup/database-bank-2017-03-27-weekly', 8 | 'gs://acme-co-backup/database-bank-2017-03-28-nightly', 9 | 'gs://acme-co-backup/database-bank-2017-03-29-nightly' 10 | AS OF SYSTEM TIME '2017-02-28 10:00:00' 11 | WITH into_db = 'newdb' 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/restore.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | RESTORE 6 | TABLE bank.customers 7 | FROM 'gs://acme-co-backup/database-bank-2017-03-27-weekly', 8 | 'gs://acme-co-backup/database-bank-2017-03-28-nightly', 9 | 'gs://acme-co-backup/database-bank-2017-03-29-nightly' 10 | AS OF SYSTEM TIME '2017-02-28 10:00:00' 11 | WITH into_db = 'newdb' 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/restore.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | RESTORE 6 | TABLE 7 | bank.customers 8 | FROM 9 | 'gs://acme-co-backup/database-bank-2017-03-27-weekly', 10 | 'gs://acme-co-backup/database-bank-2017-03-28-nightly', 11 | 'gs://acme-co-backup/database-bank-2017-03-29-nightly' 12 | AS OF SYSTEM TIME 13 | '2017-02-28 10:00:00' 14 | WITH 15 | into_db = 'newdb' 16 | 17 | 18 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/restore.sql: -------------------------------------------------------------------------------- 1 | RESTORE bank.customers 2 | FROM 'gs://acme-co-backup/database-bank-2017-03-27-weekly', 'gs://acme-co-backup/database-bank-2017-03-28-nightly', 'gs://acme-co-backup/database-bank-2017-03-29-nightly' 3 | AS OF SYSTEM TIME '2017-02-28 10:00:00' 4 | WITH into_db = 'newdb' 5 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/srfs.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT * 6 | FROM generate_series(a), 7 | generate_series(b), 8 | ROWS FROM ( 9 | generate_series(a), 10 | generate_series(b) 11 | ) 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/srfs.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT * 6 | FROM generate_series(a), 7 | generate_series(b), 8 | ROWS FROM ( 9 | generate_series(a), 10 | generate_series(b) 11 | ) 12 | 13 | 14 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/srfs.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | * 7 | FROM 8 | generate_series(a), 9 | generate_series(b), 10 | ROWS FROM ( 11 | generate_series(a), 12 | generate_series(b) 13 | ) 14 | 15 | 16 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/srfs.sql: -------------------------------------------------------------------------------- 1 | select * from 2 | generate_series(a), -- a simple scalar expression 3 | rows from(generate_series(b)), -- a rows from clause that can be elided 4 | rows from(generate_series(a), generate_series(b)) -- this one not 5 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/union_all.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT a, b, c FROM x 6 | UNION ALL SELECT d, e, f FROM y 7 | 8 | 9 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/union_all.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT a, b, c FROM x 6 | UNION ALL SELECT d, e, f FROM y 7 | 8 | 9 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/union_all.ref.golden: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | a, 7 | b, 8 | c 9 | FROM 10 | x 11 | UNION ALL 12 | SELECT 13 | d, 14 | e, 15 | f 16 | FROM 17 | y 18 | 19 | 11: 20 | ----------- 21 | SELECT 22 | a, b, c 23 | FROM 24 | x 25 | UNION ALL 26 | SELECT 27 | d, 28 | e, 29 | f 30 | FROM 31 | y 32 | 33 | 15: 34 | --------------- 35 | SELECT 36 | a, b, c 37 | FROM 38 | x 39 | UNION ALL 40 | SELECT 41 | d, e, f 42 | FROM 43 | y 44 | 45 | 21: 46 | --------------------- 47 | SELECT a, b, c FROM x 48 | UNION ALL 49 | SELECT 50 | d, e, f 51 | FROM 52 | y 53 | 54 | 25: 55 | ------------------------- 56 | SELECT a, b, c FROM x 57 | UNION ALL 58 | SELECT d, e, f FROM y 59 | 60 | 31: 61 | ------------------------------- 62 | SELECT a, b, c FROM x 63 | UNION ALL SELECT d, e, f FROM y 64 | 65 | 53: 66 | ----------------------------------------------------- 67 | SELECT a, b, c FROM x UNION ALL SELECT d, e, f FROM y 68 | 69 | 70 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/union_all.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT a, b, c FROM x 6 | UNION ALL SELECT d, e, f FROM y 7 | 8 | 9 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/union_all.sql: -------------------------------------------------------------------------------- 1 | select a,b,c from x union all select d,e,f from y 2 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/window.align-deindent.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT sum(a) OVER w, 6 | avg(b) OVER ( 7 | PARTITION BY c 8 | ORDER BY d 9 | ROWS e PRECEDING 10 | ), 11 | min(f) OVER ( 12 | ORDER BY g 13 | RANGE BETWEEN 14 | UNBOUNDED PRECEDING 15 | AND 16 | h FOLLOWING 17 | EXCLUDE TIES 18 | ) 19 | FROM t 20 | WINDOW w AS ( 21 | PARTITION BY i 22 | GROUPS BETWEEN j PRECEDING 23 | AND CURRENT ROW 24 | ) 25 | 26 | 27 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/window.align-only.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT sum(a) OVER w, 6 | avg(b) OVER ( 7 | PARTITION BY c 8 | ORDER BY d 9 | ROWS e PRECEDING 10 | ), 11 | min(f) OVER ( 12 | ORDER BY g 13 | RANGE BETWEEN 14 | UNBOUNDED PRECEDING 15 | AND 16 | h FOLLOWING 17 | EXCLUDE TIES 18 | ) 19 | FROM t 20 | WINDOW w AS ( 21 | PARTITION BY i 22 | GROUPS BETWEEN j PRECEDING 23 | AND CURRENT ROW 24 | ) 25 | 26 | 27 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/window.ref.golden.short: -------------------------------------------------------------------------------- 1 | // Code generated by TestPretty. DO NOT EDIT. 2 | // GENERATED FILE DO NOT EDIT 3 | 1: 4 | - 5 | SELECT 6 | sum(a) OVER w, 7 | avg(b) OVER ( 8 | PARTITION BY 9 | c 10 | ORDER BY 11 | d 12 | ROWS 13 | e PRECEDING 14 | ), 15 | min(f) OVER ( 16 | ORDER BY 17 | g 18 | RANGE 19 | BETWEEN 20 | UNBOUNDED PRECEDING 21 | AND 22 | h FOLLOWING 23 | EXCLUDE TIES 24 | ) 25 | FROM 26 | t 27 | WINDOW 28 | w AS ( 29 | PARTITION BY 30 | i 31 | GROUPS 32 | BETWEEN 33 | j PRECEDING 34 | AND 35 | CURRENT ROW 36 | ) 37 | 38 | 39 | -------------------------------------------------------------------------------- /pkg/sql/sem/tree/testdata/pretty/window.sql: -------------------------------------------------------------------------------- 1 | select sum(a) over w, avg(b) over (partition by c order by d rows e preceding), min(f) over (order by g range between unbounded preceding and h following exclude ties) from t window w as (partition by i groups between j preceding and current row exclude no others) 2 | -------------------------------------------------------------------------------- /pkg/testutils/error.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package testutils 12 | 13 | import ( 14 | "regexp" 15 | 16 | "github.com/auxten/postgresql-parser/pkg/sql/pgwire/pgerror" 17 | ) 18 | 19 | // IsError returns true if the error string matches the supplied regex. 20 | // An empty regex is interpreted to mean that a nil error is expected. 21 | func IsError(err error, re string) bool { 22 | if err == nil && re == "" { 23 | return true 24 | } 25 | if err == nil || re == "" { 26 | return false 27 | } 28 | errString := pgerror.FullError(err) 29 | matched, merr := regexp.MatchString(re, errString) 30 | if merr != nil { 31 | return false 32 | } 33 | return matched 34 | } 35 | 36 | -------------------------------------------------------------------------------- /pkg/util/encoding/complement_fast.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | // +build 386 amd64 12 | 13 | package encoding 14 | 15 | import "unsafe" 16 | 17 | // The idea for the fast ones complement is borrowed from fastXORBytes 18 | // in the crypto standard library. 19 | const wordSize = int(unsafe.Sizeof(uintptr(0))) 20 | 21 | func onesComplement(b []byte) { 22 | n := len(b) 23 | w := n / wordSize 24 | if w > 0 { 25 | bw := *(*[]uintptr)(unsafe.Pointer(&b)) 26 | for i := 0; i < w; i++ { 27 | bw[i] = ^bw[i] 28 | } 29 | } 30 | 31 | for i := w * wordSize; i < n; i++ { 32 | b[i] = ^b[i] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /pkg/util/encoding/complement_safe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | // +build !386,!amd64 12 | 13 | package encoding 14 | 15 | func onesComplement(b []byte) { 16 | for i := range b { 17 | b[i] = ^b[i] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pkg/util/encoding/main_test.go.bak: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package encoding_test 12 | 13 | import ( 14 | "os" 15 | "testing" 16 | 17 | _ "github.com/auxten/postgresql-parser/pkg/util/log" // for flags 18 | "github.com/auxten/postgresql-parser/pkg/util/randutil" 19 | ) 20 | 21 | func TestMain(m *testing.M) { 22 | randutil.SeedForTests() 23 | os.Exit(m.Run()) 24 | } 25 | -------------------------------------------------------------------------------- /pkg/util/envutil/env_test.go.bak: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package envutil 12 | 13 | import ( 14 | "os" 15 | "testing" 16 | ) 17 | 18 | func TestEnvOrDefault(t *testing.T) { 19 | const def = 123 20 | os.Clearenv() 21 | // These tests are mostly an excuse to exercise otherwise unused code. 22 | // TODO(knz): Test everything. 23 | if act := EnvOrDefaultBytes("COCKROACH_X", def); act != def { 24 | t.Errorf("expected %d, got %d", def, act) 25 | } 26 | if act := EnvOrDefaultInt("COCKROACH_X", def); act != def { 27 | t.Errorf("expected %d, got %d", def, act) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /pkg/util/json/fuzz.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | // +build gofuzz 12 | 13 | package json 14 | 15 | func FuzzParseJSON(data []byte) int { 16 | _, err := ParseJSON(string(data)) 17 | if err != nil { 18 | return 0 19 | } 20 | return 1 21 | } 22 | -------------------------------------------------------------------------------- /pkg/util/json/testdata/README: -------------------------------------------------------------------------------- 1 | Many of the test cases in this directory are copied or derived from the JSON 2 | Parsing Test Suite, available online at: 3 | 4 | https://github.com/nst/JSONTestSuite 5 | 6 | These test cases are Copyright (c) 2016 Nicolas Seriot and subject to the terms 7 | of the MIT license that can be found in licenses/MIT-jsontestsuite.txt. 8 | -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/a.json.bytes: -------------------------------------------------------------------------------- 1 | [32 0 0 0 16 0 0 3 102 111 111] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_arraysWithSpaces.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 208 0 0 4 128 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_empty-string.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_empty.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_ending_with_newline.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 1 97] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_false.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 176 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_heterogeneous.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 4 128 0 0 0 32 0 0 4 16 0 0 1 80 0 0 4 3 52 137 1 49 64 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_null.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 128 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_with_1_and_newline.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 137 1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_with_leading_space.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 137 1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_with_several_null.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 5 160 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 32 0 0 4 3 52 137 1 3 52 137 2] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/array_with_trailing_space.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 137 2] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 204 123] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_after_space.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 137 4] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_double_close_to_zero.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 38 213 1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_int_with_exp.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 139 20] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_minus_zero.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 3 2 26 137] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_negative_int.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 26 139 123] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_negative_one.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 26 137 1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_negative_zero.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 3 2 26 137] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_real_capital_e.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 159 1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_real_capital_e_neg_exp.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 40 137 1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_real_capital_e_pos_exp.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 139 1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_real_exponent.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 184 123] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_real_fraction_exponent.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 6 5 52 217 1 226 64] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_real_neg_exp.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 40 137 1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_real_pos_exponent.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 139 1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_simple_int.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 4 3 52 139 123] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/number_simple_real.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 160 0 0 7 6 52 139 7 91 205 21] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 2 144 0 0 3 16 0 0 3 144 0 0 9 16 0 0 3 97 115 100 100 102 103 115 100 102 102 103 104] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_basic.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 1 144 0 0 3 144 0 0 6 97 115 100 115 100 102] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_duplicated_key.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 1 144 0 0 1 144 0 0 2 97 99] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_duplicated_key_and_value.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 1 144 0 0 1 144 0 0 2 97 98] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_empty.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_empty_key.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 1 144 0 0 0 160 0 0 2 1 39] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_escaped_null_in_key.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 1 144 0 0 7 160 0 0 11 102 111 111 0 98 97 114 3 52 138 42] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_extreme_numbers.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 2 144 0 0 3 16 0 0 3 160 0 0 10 32 0 0 4 109 97 120 109 105 110 3 52 165 10 3 26 165 10] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_long_strings.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 2 144 0 0 2 16 0 0 1 144 0 0 43 80 0 0 62 105 100 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 128 0 0 1 208 0 0 54 64 0 0 1 144 0 0 2 144 0 0 42 105 100 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_simple.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 1 144 0 0 1 208 0 0 5 97 128 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_string_unicode.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 1 144 0 0 5 144 0 0 38 116 105 116 108 101 208 159 208 190 208 187 209 130 208 190 209 128 208 176 32 208 151 208 181 208 188 208 187 208 181 208 186 208 190 208 191 208 176] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/object_with_newlines.json.bytes: -------------------------------------------------------------------------------- 1 | [64 0 0 1 144 0 0 1 144 0 0 2 97 98] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_1_2_3_bytes_UTF-8_sequences.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 6 96 196 170 225 138 171] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_accepted_surrogate_pair.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 4 240 144 144 183] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_accepted_surrogate_pairs.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 8 240 159 152 185 240 159 146 141] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_allowed_escapes.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 8 34 92 47 8 12 10 13 9] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_and_u_escaped_zero.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 6 92 117 48 48 48 48] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_comments.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 13 97 47 42 98 42 47 99 47 42 100 47 47 101] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_double_escape_a.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 2 92 97] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_double_escape_n.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 2 92 110] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_doublequotes.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 1 34] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_escaped_control_character.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 1 18] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_escaped_noncharacter.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 239 191 191] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_in_array.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 97 115 100] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_in_array_with_leading_space.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 97 115 100] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_last_surrogates_1_and_2.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 4 244 143 191 191] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_nbsp_uescaped.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 9 110 101 119 194 160 108 105 110 101] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_nonCharacterInUTF-8_U+10FFFF.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 4 244 143 191 191] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_nonCharacterInUTF-8_U+1FFFF.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 4 240 155 191 191] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_nonCharacterInUTF-8_U+FFFF.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 239 191 191] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_null_escape.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 1 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_one-byte-utf-8.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 1 44] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_pi.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 2 207 128] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_simple_ascii.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 4 97 115 100 32] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_space.json.bytes: -------------------------------------------------------------------------------- 1 | [32 0 0 0 16 0 0 1 32] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 4 240 157 132 158] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_three-byte-utf-8.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 224 160 161] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_two-byte-utf-8.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 2 196 163] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_u+2028_line_sep.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 226 128 168] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_u+2029_par_sep.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 226 128 169] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_uEscape.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 10 97 227 130 175 227 131 170 227 130 185] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_uescaped_newline.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 8 110 101 119 10 108 105 110 101] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unescaped_char_delete.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 1 127] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unicode.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 234 153 173] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unicodeEscapedBackslash.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 1 92] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unicode_2.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 9 226 141 130 227 136 180 226 141 130] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unicode_U+10FFFE_nonchar.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 4 244 143 191 190] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unicode_U+1FFFE_nonchar.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 4 240 159 191 190] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unicode_U+200B_ZERO_WIDTH_SPACE.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 226 128 139] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unicode_U+2064_invisible_plus.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 226 129 164] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unicode_U+FDD0_nonchar.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 239 183 144] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unicode_U+FFFE_nonchar.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 239 191 190] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_unicode_escaped_double_quote.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 1 34] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_utf8.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 7 226 130 172 240 157 132 158] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/string_with_del_character.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 3 97 127 97] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/structure_lonely_false.json.bytes: -------------------------------------------------------------------------------- 1 | [32 0 0 0 48 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/structure_lonely_int.json.bytes: -------------------------------------------------------------------------------- 1 | [32 0 0 0 32 0 0 4 3 52 138 42] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/structure_lonely_negative_real.json.bytes: -------------------------------------------------------------------------------- 1 | [32 0 0 0 32 0 0 3 2 37 1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/structure_lonely_null.json.bytes: -------------------------------------------------------------------------------- 1 | [32 0 0 0 0 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/structure_lonely_string.json.bytes: -------------------------------------------------------------------------------- 1 | [32 0 0 0 16 0 0 3 97 115 100] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/structure_lonely_true.json.bytes: -------------------------------------------------------------------------------- 1 | [32 0 0 0 64 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/structure_string_empty.json.bytes: -------------------------------------------------------------------------------- 1 | [32 0 0 0 16 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/structure_trailing_newline.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 144 0 0 1 97] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/structure_true_in_array.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 1 192 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/encoded/structure_whitespace_array.json.bytes: -------------------------------------------------------------------------------- 1 | [128 0 0 0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/a.json: -------------------------------------------------------------------------------- 1 | "foo" 2 | -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_arraysWithSpaces.json: -------------------------------------------------------------------------------- 1 | [[] ] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_empty-string.json: -------------------------------------------------------------------------------- 1 | [""] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_empty.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_ending_with_newline.json: -------------------------------------------------------------------------------- 1 | ["a"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_false.json: -------------------------------------------------------------------------------- 1 | [false] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_heterogeneous.json: -------------------------------------------------------------------------------- 1 | [null, 1, "1", {}] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_null.json: -------------------------------------------------------------------------------- 1 | [null] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_with_1_and_newline.json: -------------------------------------------------------------------------------- 1 | [1 2 | ] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_with_leading_space.json: -------------------------------------------------------------------------------- 1 | [1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_with_several_null.json: -------------------------------------------------------------------------------- 1 | [1,null,null,null,2] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/array_with_trailing_space.json: -------------------------------------------------------------------------------- 1 | [2] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number.json: -------------------------------------------------------------------------------- 1 | [123e65] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_after_space.json: -------------------------------------------------------------------------------- 1 | [ 4] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_double_close_to_zero.json: -------------------------------------------------------------------------------- 1 | [-0.000000000000000000000000000000000000000000000000000000000000000000000000000001] 2 | -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_int_with_exp.json: -------------------------------------------------------------------------------- 1 | [20e1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_minus_zero.json: -------------------------------------------------------------------------------- 1 | [-0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_negative_int.json: -------------------------------------------------------------------------------- 1 | [-123] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_negative_one.json: -------------------------------------------------------------------------------- 1 | [-1] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_negative_zero.json: -------------------------------------------------------------------------------- 1 | [-0] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_real_capital_e.json: -------------------------------------------------------------------------------- 1 | [1E22] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_real_capital_e_neg_exp.json: -------------------------------------------------------------------------------- 1 | [1E-2] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_real_capital_e_pos_exp.json: -------------------------------------------------------------------------------- 1 | [1E+2] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_real_exponent.json: -------------------------------------------------------------------------------- 1 | [123e45] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_real_fraction_exponent.json: -------------------------------------------------------------------------------- 1 | [123.456e78] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_real_neg_exp.json: -------------------------------------------------------------------------------- 1 | [1e-2] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_real_pos_exponent.json: -------------------------------------------------------------------------------- 1 | [1e+2] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_simple_int.json: -------------------------------------------------------------------------------- 1 | [123] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/number_simple_real.json: -------------------------------------------------------------------------------- 1 | [123.456789] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object.json: -------------------------------------------------------------------------------- 1 | {"asd":"sdf", "dfg":"fgh"} -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_basic.json: -------------------------------------------------------------------------------- 1 | {"asd":"sdf"} -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_duplicated_key.json: -------------------------------------------------------------------------------- 1 | {"a":"b","a":"c"} -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_duplicated_key_and_value.json: -------------------------------------------------------------------------------- 1 | {"a":"b","a":"b"} -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_empty.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_empty_key.json: -------------------------------------------------------------------------------- 1 | {"":0} -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_escaped_null_in_key.json: -------------------------------------------------------------------------------- 1 | {"foo\u0000bar": 42} -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_extreme_numbers.json: -------------------------------------------------------------------------------- 1 | { "min": -1.0e+28, "max": 1.0e+28 } -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_long_strings.json: -------------------------------------------------------------------------------- 1 | {"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}], "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_simple.json: -------------------------------------------------------------------------------- 1 | {"a":[]} -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_string_unicode.json: -------------------------------------------------------------------------------- 1 | {"title":"\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430" } -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/object_with_newlines.json: -------------------------------------------------------------------------------- 1 | { 2 | "a": "b" 3 | } -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_1_2_3_bytes_UTF-8_sequences.json: -------------------------------------------------------------------------------- 1 | ["\u0060\u012a\u12AB"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_accepted_surrogate_pair.json: -------------------------------------------------------------------------------- 1 | ["\uD801\udc37"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_accepted_surrogate_pairs.json: -------------------------------------------------------------------------------- 1 | ["\ud83d\ude39\ud83d\udc8d"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_allowed_escapes.json: -------------------------------------------------------------------------------- 1 | ["\"\\\/\b\f\n\r\t"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_and_u_escaped_zero.json: -------------------------------------------------------------------------------- 1 | ["\\u0000"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_comments.json: -------------------------------------------------------------------------------- 1 | ["a/*b*/c/*d//e"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_double_escape_a.json: -------------------------------------------------------------------------------- 1 | ["\\a"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_double_escape_n.json: -------------------------------------------------------------------------------- 1 | ["\\n"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_doublequotes.json: -------------------------------------------------------------------------------- 1 | ["\""] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_escaped_control_character.json: -------------------------------------------------------------------------------- 1 | ["\u0012"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_escaped_noncharacter.json: -------------------------------------------------------------------------------- 1 | ["\uFFFF"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_in_array.json: -------------------------------------------------------------------------------- 1 | ["asd"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_in_array_with_leading_space.json: -------------------------------------------------------------------------------- 1 | [ "asd"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_last_surrogates_1_and_2.json: -------------------------------------------------------------------------------- 1 | ["\uDBFF\uDFFF"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_nbsp_uescaped.json: -------------------------------------------------------------------------------- 1 | ["new\u00A0line"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_nonCharacterInUTF-8_U+10FFFF.json: -------------------------------------------------------------------------------- 1 | ["􏿿"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_nonCharacterInUTF-8_U+1FFFF.json: -------------------------------------------------------------------------------- 1 | ["𛿿"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_nonCharacterInUTF-8_U+FFFF.json: -------------------------------------------------------------------------------- 1 | ["￿"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_null_escape.json: -------------------------------------------------------------------------------- 1 | ["\u0000"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_one-byte-utf-8.json: -------------------------------------------------------------------------------- 1 | ["\u002c"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_pi.json: -------------------------------------------------------------------------------- 1 | ["π"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_simple_ascii.json: -------------------------------------------------------------------------------- 1 | ["asd "] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_space.json: -------------------------------------------------------------------------------- 1 | " " -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json: -------------------------------------------------------------------------------- 1 | ["\uD834\uDd1e"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_three-byte-utf-8.json: -------------------------------------------------------------------------------- 1 | ["\u0821"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_two-byte-utf-8.json: -------------------------------------------------------------------------------- 1 | ["\u0123"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_u+2028_line_sep.json: -------------------------------------------------------------------------------- 1 | ["
"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_u+2029_par_sep.json: -------------------------------------------------------------------------------- 1 | ["
"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_uEscape.json: -------------------------------------------------------------------------------- 1 | ["\u0061\u30af\u30EA\u30b9"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_uescaped_newline.json: -------------------------------------------------------------------------------- 1 | ["new\u000Aline"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unescaped_char_delete.json: -------------------------------------------------------------------------------- 1 | [""] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unicode.json: -------------------------------------------------------------------------------- 1 | ["\uA66D"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unicodeEscapedBackslash.json: -------------------------------------------------------------------------------- 1 | ["\u005C"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unicode_2.json: -------------------------------------------------------------------------------- 1 | ["⍂㈴⍂"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unicode_U+10FFFE_nonchar.json: -------------------------------------------------------------------------------- 1 | ["\uDBFF\uDFFE"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unicode_U+1FFFE_nonchar.json: -------------------------------------------------------------------------------- 1 | ["\uD83F\uDFFE"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unicode_U+200B_ZERO_WIDTH_SPACE.json: -------------------------------------------------------------------------------- 1 | ["\u200B"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unicode_U+2064_invisible_plus.json: -------------------------------------------------------------------------------- 1 | ["\u2064"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unicode_U+FDD0_nonchar.json: -------------------------------------------------------------------------------- 1 | ["\uFDD0"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unicode_U+FFFE_nonchar.json: -------------------------------------------------------------------------------- 1 | ["\uFFFE"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_unicode_escaped_double_quote.json: -------------------------------------------------------------------------------- 1 | ["\u0022"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_utf8.json: -------------------------------------------------------------------------------- 1 | ["€𝄞"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/string_with_del_character.json: -------------------------------------------------------------------------------- 1 | ["aa"] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/structure_lonely_false.json: -------------------------------------------------------------------------------- 1 | false -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/structure_lonely_int.json: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/structure_lonely_negative_real.json: -------------------------------------------------------------------------------- 1 | -0.1 -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/structure_lonely_null.json: -------------------------------------------------------------------------------- 1 | null -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/structure_lonely_string.json: -------------------------------------------------------------------------------- 1 | "asd" -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/structure_lonely_true.json: -------------------------------------------------------------------------------- 1 | true -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/structure_string_empty.json: -------------------------------------------------------------------------------- 1 | "" -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/structure_trailing_newline.json: -------------------------------------------------------------------------------- 1 | ["a"] 2 | -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/structure_true_in_array.json: -------------------------------------------------------------------------------- 1 | [true] -------------------------------------------------------------------------------- /pkg/util/json/testdata/raw/structure_whitespace_array.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /pkg/util/leaktest/check-leaktest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | pkgs=$(git grep 'go:generate' | grep add-leaktest.sh | awk -F: '{print $1}' | xargs -n1 dirname) 6 | for pkg in ${pkgs}; do 7 | if [ -z "$(ls ${pkg}/*_test.go 2>/dev/null)" ]; then 8 | # skip packages without _test.go files. 9 | continue 10 | fi 11 | 12 | awk -F'[ (]' ' 13 | /func Test.*testing.T\) {/ { 14 | test = $2 15 | next 16 | } 17 | 18 | /defer leaktest.AfterTest\(.+\)\(\)/ { 19 | test = 0 20 | next 21 | } 22 | 23 | { 24 | if (test) { 25 | printf "%s: %s: missing defer leaktest.AfterTest\n", FILENAME, test 26 | test = 0 27 | code = 1 28 | } 29 | } 30 | 31 | END { 32 | exit code 33 | } 34 | ' ${pkg}/*_test.go 35 | done 36 | -------------------------------------------------------------------------------- /pkg/util/nocopy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package util 12 | 13 | // NoCopy may be embedded into structs which must not be copied 14 | // after the first use. 15 | // 16 | // See https://github.com/golang/go/issues/8005#issuecomment-190753527 17 | // for details. 18 | type NoCopy struct{} 19 | 20 | // Silence unused warnings. 21 | var _ = NoCopy{} 22 | 23 | // Lock is a no-op used by -copylocks checker from `go vet`. 24 | func (*NoCopy) Lock() {} 25 | 26 | // Unlock is a no-op used by -copylocks checker from `go vet`. 27 | func (*NoCopy) Unlock() {} 28 | -------------------------------------------------------------------------------- /pkg/util/protoutil/clone.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | syntax = "proto3"; 12 | package cockroach.util.protoutil; 13 | option go_package = "protoutil"; 14 | 15 | import "gogoproto/gogo.proto"; 16 | 17 | message RecursiveAndUncloneable { 18 | RecursiveAndUncloneable r = 1; 19 | bytes uuid = 2 [(gogoproto.nullable) = false, 20 | (gogoproto.customtype) = "github.com/cockroachdb/cockroach/pkg/util/uuid.UUID"]; 21 | } 22 | -------------------------------------------------------------------------------- /pkg/util/protoutil/fuzz_disabled.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | //+build !race 12 | 13 | package protoutil 14 | 15 | const fuzzEnabled = false 16 | -------------------------------------------------------------------------------- /pkg/util/protoutil/fuzz_enabled.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | //+build race 12 | 13 | package protoutil 14 | 15 | const fuzzEnabled = true 16 | -------------------------------------------------------------------------------- /pkg/util/set/dedup.go: -------------------------------------------------------------------------------- 1 | package set 2 | 3 | import ( 4 | "sort" 5 | ) 6 | 7 | func SortDeDup(l []string) []string { 8 | n := len(l) 9 | if n <= 1 { 10 | return l 11 | } 12 | sort.Strings(l) 13 | 14 | j := 1 15 | for i := 1; i < n; i++ { 16 | if l[i] != l[i-1] { 17 | l[j] = l[i] 18 | j++ 19 | } 20 | } 21 | 22 | return l[0:j] 23 | } 24 | -------------------------------------------------------------------------------- /pkg/util/timeutil/main_test.go.bak: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package timeutil_test 12 | 13 | import ( 14 | "os" 15 | "testing" 16 | 17 | _ "github.com/auxten/postgresql-parser/pkg/util/log" // for flags 18 | "github.com/auxten/postgresql-parser/pkg/util/randutil" 19 | ) 20 | 21 | func TestMain(m *testing.M) { 22 | randutil.SeedForTests() 23 | os.Exit(m.Run()) 24 | } 25 | -------------------------------------------------------------------------------- /pkg/util/timeutil/now_test.go.bak: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package timeutil 12 | 13 | import "testing" 14 | 15 | func BenchmarkNow(b *testing.B) { 16 | for i := 0; i < b.N; i++ { 17 | Now() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pkg/util/timeutil/now_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | // +build !windows 12 | 13 | package timeutil 14 | 15 | import "time" 16 | 17 | // Now returns the current UTC time. 18 | func Now() time.Time { 19 | return time.Now().UTC() 20 | } 21 | -------------------------------------------------------------------------------- /pkg/util/timeutil/pgdate/parsemode_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=ParseMode"; DO NOT EDIT. 2 | 3 | package pgdate 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[ParseModeYMD-0] 12 | _ = x[ParseModeDMY-1] 13 | _ = x[ParseModeMDY-2] 14 | } 15 | 16 | const _ParseMode_name = "ParseModeYMDParseModeDMYParseModeMDY" 17 | 18 | var _ParseMode_index = [...]uint8{0, 12, 24, 36} 19 | 20 | func (i ParseMode) String() string { 21 | if i >= ParseMode(len(_ParseMode_index)-1) { 22 | return "ParseMode(" + strconv.FormatInt(int64(i), 10) + ")" 23 | } 24 | return _ParseMode_name[_ParseMode_index[i]:_ParseMode_index[i+1]] 25 | } 26 | -------------------------------------------------------------------------------- /pkg/util/uuid/benchmark_fast_test.go.bak: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Cockroach Authors. 2 | // 3 | // Use of this software is governed by the Business Source License 4 | // included in the file licenses/BSL.txt. 5 | // 6 | // As of the Change Date specified in that file, in accordance with 7 | // the Business Source License, use of this software will be governed 8 | // by the Apache License, Version 2.0, included in the file 9 | // licenses/APL.txt. 10 | 11 | package uuid_test 12 | 13 | import ( 14 | "testing" 15 | 16 | "github.com/auxten/postgresql-parser/pkg/util/uuid" 17 | ) 18 | 19 | func BenchmarkFastMakeV4(b *testing.B) { 20 | for i := 0; i < b.N; i++ { 21 | uuid.FastMakeV4() 22 | } 23 | } 24 | 25 | func BenchmarkMakeV4(b *testing.B) { 26 | for i := 0; i < b.N; i++ { 27 | uuid.MakeV4() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/1416586f4a34d02bcb506f6107b40df512b9f2f9: -------------------------------------------------------------------------------- 1 | zba7b810-9dad-11d1-80b4-00c04fd4 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/3b46a7e7b02ec193581e6c9fa2c8a72f50a64e08-1: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad-11d1-80F4-00c"4fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/50c54bb75fcfdc488f162bf2f0c6dec6103bfa18-5: -------------------------------------------------------------------------------- 1 | 6ad1DdE8dda91DdE80F400c0Bool30t: -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/69c581ab749cbd56be8684d3a58ac2cfab9af0f4-5: -------------------------------------------------------------------------------- 1 | 6ba7b810Edad1DdE80F400c0Bool30c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/752bf000e0bff06777dd0d6f0be6353844de678a-3: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad1Dd180F400c0Bool30c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/a4483762d4ece8466d82cca5cacd35a0829c4e60-2: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad-11d1-80F4-F0c"4fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/d0952c45e0c823fc5cc12bcf7d9b877d150ab523-1: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad11d180b400c0Bool30c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/da39a3ee5e6b4b0d3255bfef95601890afd80709: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auxten/postgresql-parser/86ca800d7f2e02c2120cffb08a93165a1cdeda43/pkg/util/uuid/testdata/corpus/da39a3ee5e6b4b0d3255bfef95601890afd80709 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/e2b84d2065846891f18ae109b12e01d224e1c7c3-4: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad1DdE80F400c0Bool30c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/e320d749435115e874f77420e17d0937e07f69f3-2: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad1Dd180b400c0Bool30c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/ed132d47d757f6468443a22df8a2a965efb34098-7: -------------------------------------------------------------------------------- 1 | 6ba1DdE8dDAE8DdE80F400c0BoUl30to -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/eeefb01f7bb3c627aedb292c994b20f739ffd613-6: -------------------------------------------------------------------------------- 1 | 6ad1DdE8dDdE8DdE80F400c0Bool30t: -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_0: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad-11d1-80b4-00c04fd430c -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_1: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad11d180b400c04fd430c -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_10: -------------------------------------------------------------------------------- 1 | uuid:urn:6ba7b810-9dad-11d1-80b4-00c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_11: -------------------------------------------------------------------------------- 1 | uuid:urn:6ba7b8109dad11d180b400c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_12: -------------------------------------------------------------------------------- 1 | 6ba7b8109-dad-11d1-80b4-00c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_13: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad1-1d1-80b4-00c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_14: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad-11d18-0b4-00c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_15: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad-11d1-80b40-0c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_16: -------------------------------------------------------------------------------- 1 | 6ba7b810+9dad+11d1+80b4+00c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_17: -------------------------------------------------------------------------------- 1 | (6ba7b810-9dad-11d1-80b4-00c04fd430c8} -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_18: -------------------------------------------------------------------------------- 1 | {6ba7b810-9dad-11d1-80b4-00c04fd430c8> -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_19: -------------------------------------------------------------------------------- 1 | zba7b810-9dad-11d1-80b4-00c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_2: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad11d180b400c04fd430q8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_20: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad11d180b400c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_21: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad-11d180b400c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_22: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad11d1-80b400c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_23: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad11d180b4-00c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_3: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad-11d1-80b4-00c04fd430c8= -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_4: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad-11d1-80b4-00c04fd430c8} -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_5: -------------------------------------------------------------------------------- 1 | {6ba7b810-9dad-11d1-80b4-00c04fd430c8}f -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_6: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad-11d1-80b4-00c04fd430c800c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_7: -------------------------------------------------------------------------------- 1 | ba7b8109dad11d180b400c04fd430c8} -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_8: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad11d180b400c04fd430c86ba7b8109dad11d180b400c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_invalid_9: -------------------------------------------------------------------------------- 1 | urn:uuid:{6ba7b810-9dad-11d1-80b4-00c04fd430c8} -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_valid_BracedCanonical: -------------------------------------------------------------------------------- 1 | {6ba7b810-9dad-11d1-80b4-00c04fd430c8} -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_valid_BracedHashlike: -------------------------------------------------------------------------------- 1 | {6ba7b8109dad11d180b400c04fd430c8} -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_valid_Canonical: -------------------------------------------------------------------------------- 1 | 6ba7b810-9dad-11d1-80b4-00c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_valid_Hashlike: -------------------------------------------------------------------------------- 1 | 6ba7b8109dad11d180b400c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_valid_URNCanonical: -------------------------------------------------------------------------------- 1 | urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8 -------------------------------------------------------------------------------- /pkg/util/uuid/testdata/corpus/seed_valid_URNHashlike: -------------------------------------------------------------------------------- 1 | urn:uuid:6ba7b8109dad11d180b400c04fd430c8 --------------------------------------------------------------------------------