Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
32556: sql: more assorted telemetry fixes r=knz a=knz

Fixes cockroachdb#31990. Requested by @awoods187.

Co-authored-by: Raphael 'kena' Poss <[email protected]>
  • Loading branch information
craig[bot] and knz committed Nov 26, 2018
2 parents 49c9cf2 + 31d94f1 commit a36a9a7
Show file tree
Hide file tree
Showing 13 changed files with 168 additions and 102 deletions.
2 changes: 1 addition & 1 deletion docs/generated/sql/bnf/delete_stmt.bnf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
delete_stmt ::=
( ( 'WITH' ( ( common_table_expr ) ( ( ',' common_table_expr ) )* ) ) | ) 'DELETE' 'FROM' ( ( table_name opt_index_flags ) | ( table_name opt_index_flags ) table_alias_name | ( table_name opt_index_flags ) 'AS' table_alias_name ) ( 'WHERE' a_expr | ) ( sort_clause | ) ( limit_clause | ) ( 'RETURNING' target_list | 'RETURNING' 'NOTHING' | )
( ( 'WITH' ( ( common_table_expr ) ( ( ',' common_table_expr ) )* ) ) | ) 'DELETE' 'FROM' ( ( table_name opt_index_flags ) | ( table_name opt_index_flags ) table_alias_name | ( table_name opt_index_flags ) 'AS' table_alias_name ) ( ( 'WHERE' a_expr ) | ) ( sort_clause | ) ( limit_clause | ) ( 'RETURNING' target_list | 'RETURNING' 'NOTHING' | )
4 changes: 2 additions & 2 deletions docs/generated/sql/bnf/on_conflict.bnf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
on_conflict ::=
'ON' 'CONFLICT' ( '(' ( ( name ) ( ( ',' name ) )* ) ')' ( 'WHERE' a_expr | ) | ) 'DO' 'UPDATE' 'SET' ( ( ( ( column_name '=' a_expr ) | ( '(' ( ( ( column_name ) ) ( ( ',' ( column_name ) ) )* ) ')' '=' ( '(' select_stmt ')' | ( '(' ')' | '(' ( a_expr | a_expr ',' | a_expr ',' ( ( a_expr ) ( ( ',' a_expr ) )* ) ) ')' ) ) ) ) ) ( ( ',' ( ( column_name '=' a_expr ) | ( '(' ( ( ( column_name ) ) ( ( ',' ( column_name ) ) )* ) ')' '=' ( '(' select_stmt ')' | ( '(' ')' | '(' ( a_expr | a_expr ',' | a_expr ',' ( ( a_expr ) ( ( ',' a_expr ) )* ) ) ')' ) ) ) ) ) )* ) ( 'WHERE' a_expr | )
| 'ON' 'CONFLICT' ( '(' ( ( name ) ( ( ',' name ) )* ) ')' ( 'WHERE' a_expr | ) | ) 'DO' 'NOTHING'
'ON' 'CONFLICT' ( '(' ( ( name ) ( ( ',' name ) )* ) ')' | ) 'DO' 'UPDATE' 'SET' ( ( ( ( column_name '=' a_expr ) | ( '(' ( ( ( column_name ) ) ( ( ',' ( column_name ) ) )* ) ')' '=' ( '(' select_stmt ')' | ( '(' ')' | '(' ( a_expr | a_expr ',' | a_expr ',' ( ( a_expr ) ( ( ',' a_expr ) )* ) ) ')' ) ) ) ) ) ( ( ',' ( ( column_name '=' a_expr ) | ( '(' ( ( ( column_name ) ) ( ( ',' ( column_name ) ) )* ) ')' '=' ( '(' select_stmt ')' | ( '(' ')' | '(' ( a_expr | a_expr ',' | a_expr ',' ( ( a_expr ) ( ( ',' a_expr ) )* ) ) ')' ) ) ) ) ) )* ) ( ( 'WHERE' a_expr ) | )
| 'ON' 'CONFLICT' ( '(' ( ( name ) ( ( ',' name ) )* ) ')' | ) 'DO' 'NOTHING'
6 changes: 3 additions & 3 deletions docs/generated/sql/bnf/simple_select_clause.bnf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
simple_select_clause ::=
'SELECT' ( 'ALL' | ) ( ( target_elem ) ( ( ',' target_elem ) )* ) ( 'FROM' ( ( table_ref ) ( ( ',' table_ref ) )* ) ( ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ) | ) ( 'WHERE' a_expr | ) ( 'GROUP' 'BY' ( ( a_expr ) ( ( ',' a_expr ) )* ) | ) ( 'HAVING' a_expr | ) ( 'WINDOW' window_definition_list | )
| 'SELECT' ( 'DISTINCT' ) ( ( target_elem ) ( ( ',' target_elem ) )* ) ( 'FROM' ( ( table_ref ) ( ( ',' table_ref ) )* ) ( ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ) | ) ( 'WHERE' a_expr | ) ( 'GROUP' 'BY' ( ( a_expr ) ( ( ',' a_expr ) )* ) | ) ( 'HAVING' a_expr | ) ( 'WINDOW' window_definition_list | )
| 'SELECT' ( 'DISTINCT' 'ON' '(' ( ( a_expr ) ( ( ',' a_expr ) )* ) ')' ) ( ( target_elem ) ( ( ',' target_elem ) )* ) ( 'FROM' ( ( table_ref ) ( ( ',' table_ref ) )* ) ( ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ) | ) ( 'WHERE' a_expr | ) ( 'GROUP' 'BY' ( ( a_expr ) ( ( ',' a_expr ) )* ) | ) ( 'HAVING' a_expr | ) ( 'WINDOW' window_definition_list | )
'SELECT' ( 'ALL' | ) ( ( target_elem ) ( ( ',' target_elem ) )* ) ( 'FROM' ( ( table_ref ) ( ( ',' table_ref ) )* ) ( ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ) | ) ( ( 'WHERE' a_expr ) | ) ( 'GROUP' 'BY' ( ( a_expr ) ( ( ',' a_expr ) )* ) | ) ( 'HAVING' a_expr | ) ( 'WINDOW' window_definition_list | )
| 'SELECT' ( 'DISTINCT' ) ( ( target_elem ) ( ( ',' target_elem ) )* ) ( 'FROM' ( ( table_ref ) ( ( ',' table_ref ) )* ) ( ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ) | ) ( ( 'WHERE' a_expr ) | ) ( 'GROUP' 'BY' ( ( a_expr ) ( ( ',' a_expr ) )* ) | ) ( 'HAVING' a_expr | ) ( 'WINDOW' window_definition_list | )
| 'SELECT' ( 'DISTINCT' 'ON' '(' ( ( a_expr ) ( ( ',' a_expr ) )* ) ')' ) ( ( target_elem ) ( ( ',' target_elem ) )* ) ( 'FROM' ( ( table_ref ) ( ( ',' table_ref ) )* ) ( ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ) | ) ( ( 'WHERE' a_expr ) | ) ( 'GROUP' 'BY' ( ( a_expr ) ( ( ',' a_expr ) )* ) | ) ( 'HAVING' a_expr | ) ( 'WINDOW' window_definition_list | )
34 changes: 19 additions & 15 deletions docs/generated/sql/bnf/stmt_block.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ create_stmt ::=
| create_ddl_stmt

delete_stmt ::=
opt_with_clause 'DELETE' 'FROM' table_name_expr_opt_alias_idx where_clause opt_sort_clause opt_limit_clause returning_clause
opt_with_clause 'DELETE' 'FROM' table_name_expr_opt_alias_idx opt_where_clause opt_sort_clause opt_limit_clause returning_clause

drop_stmt ::=
drop_ddl_stmt
Expand Down Expand Up @@ -184,7 +184,7 @@ truncate_stmt ::=
'TRUNCATE' opt_table relation_expr_list opt_drop_behavior

update_stmt ::=
opt_with_clause 'UPDATE' table_name_expr_opt_alias_idx 'SET' set_clause_list where_clause opt_sort_clause opt_limit_clause returning_clause
opt_with_clause 'UPDATE' table_name_expr_opt_alias_idx 'SET' set_clause_list opt_where_clause opt_sort_clause opt_limit_clause returning_clause

upsert_stmt ::=
opt_with_clause 'UPSERT' 'INTO' insert_target insert_rest returning_clause
Expand Down Expand Up @@ -326,8 +326,8 @@ table_name_expr_opt_alias_idx ::=
| table_name_expr_with_index table_alias_name
| table_name_expr_with_index 'AS' table_alias_name

where_clause ::=
'WHERE' a_expr
opt_where_clause ::=
where_clause
|

opt_sort_clause ::=
Expand Down Expand Up @@ -377,7 +377,7 @@ insert_rest ::=
| 'DEFAULT' 'VALUES'

on_conflict ::=
'ON' 'CONFLICT' opt_conf_expr 'DO' 'UPDATE' 'SET' set_clause_list where_clause
'ON' 'CONFLICT' opt_conf_expr 'DO' 'UPDATE' 'SET' set_clause_list opt_where_clause
| 'ON' 'CONFLICT' opt_conf_expr 'DO' 'NOTHING'

a_expr ::=
Expand Down Expand Up @@ -737,7 +737,6 @@ unreserved_keyword ::=
| 'TESTING_RANGES'
| 'TESTING_RELOCATE'
| 'TEXT'
| 'TIMESTAMPTZ'
| 'TRACE'
| 'TRANSACTION'
| 'TRIGGER'
Expand Down Expand Up @@ -803,6 +802,7 @@ col_name_keyword ::=
| 'TIME'
| 'TIMETZ'
| 'TIMESTAMP'
| 'TIMESTAMPTZ'
| 'TREAT'
| 'TRIM'
| 'VALUES'
Expand Down Expand Up @@ -935,6 +935,9 @@ with_clause ::=
table_name_expr_with_index ::=
table_name opt_index_flags

where_clause ::=
'WHERE' a_expr

sort_clause ::=
'ORDER' 'BY' sortby_list

Expand Down Expand Up @@ -978,7 +981,7 @@ insert_column_list ::=
( insert_column_item ) ( ( ',' insert_column_item ) )*

opt_conf_expr ::=
'(' name_list ')' where_clause
'(' name_list ')'
|

c_expr ::=
Expand Down Expand Up @@ -1411,9 +1414,9 @@ scrub_option_list ::=
( scrub_option ) ( ( ',' scrub_option ) )*

simple_select_clause ::=
'SELECT' opt_all_clause target_list from_clause where_clause group_clause having_clause window_clause
| 'SELECT' distinct_clause target_list from_clause where_clause group_clause having_clause window_clause
| 'SELECT' distinct_on_clause target_list from_clause where_clause group_clause having_clause window_clause
'SELECT' opt_all_clause target_list from_clause opt_where_clause group_clause having_clause window_clause
| 'SELECT' distinct_clause target_list from_clause opt_where_clause group_clause having_clause window_clause
| 'SELECT' distinct_on_clause target_list from_clause opt_where_clause group_clause having_clause window_clause

values_clause ::=
( 'VALUES' '(' expr_list ')' ) ( ( ',' '(' expr_list ')' ) )*
Expand Down Expand Up @@ -1874,12 +1877,8 @@ character_without_length ::=

const_datetime ::=
'DATE'
| 'TIME'
| 'TIME' 'WITHOUT' 'TIME' 'ZONE'
| 'TIMESTAMP'
| 'TIMESTAMP' 'WITHOUT' 'TIME' 'ZONE'
| 'TIMESTAMP' opt_timezone
| 'TIMESTAMPTZ'
| 'TIMESTAMP' 'WITH' 'TIME' 'ZONE'

const_json ::=
'JSON'
Expand Down Expand Up @@ -2049,6 +2048,11 @@ opt_numeric_modifiers ::=
| '(' iconst64 ',' iconst64 ')'
|

opt_timezone ::=
'WITH' 'TIME' 'ZONE'
| 'WITHOUT' 'TIME' 'ZONE'
|

interval_qualifier ::=
'YEAR'
| 'MONTH'
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/sql/bnf/update_stmt.bnf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
update_stmt ::=
( ( 'WITH' ( ( common_table_expr ) ( ( ',' common_table_expr ) )* ) ) | ) 'UPDATE' ( ( table_name opt_index_flags ) | ( table_name opt_index_flags ) table_alias_name | ( table_name opt_index_flags ) 'AS' table_alias_name ) 'SET' ( ( ( ( column_name '=' a_expr ) | ( '(' ( ( ( column_name ) ) ( ( ',' ( column_name ) ) )* ) ')' '=' ( '(' select_stmt ')' | ( '(' ')' | '(' ( a_expr | a_expr ',' | a_expr ',' ( ( a_expr ) ( ( ',' a_expr ) )* ) ) ')' ) ) ) ) ) ( ( ',' ( ( column_name '=' a_expr ) | ( '(' ( ( ( column_name ) ) ( ( ',' ( column_name ) ) )* ) ')' '=' ( '(' select_stmt ')' | ( '(' ')' | '(' ( a_expr | a_expr ',' | a_expr ',' ( ( a_expr ) ( ( ',' a_expr ) )* ) ) ')' ) ) ) ) ) )* ) ( 'WHERE' a_expr | ) ( sort_clause | ) ( limit_clause | ) ( 'RETURNING' target_list | 'RETURNING' 'NOTHING' | )
( ( 'WITH' ( ( common_table_expr ) ( ( ',' common_table_expr ) )* ) ) | ) 'UPDATE' ( ( table_name opt_index_flags ) | ( table_name opt_index_flags ) table_alias_name | ( table_name opt_index_flags ) 'AS' table_alias_name ) 'SET' ( ( ( ( column_name '=' a_expr ) | ( '(' ( ( ( column_name ) ) ( ( ',' ( column_name ) ) )* ) ')' '=' ( '(' select_stmt ')' | ( '(' ')' | '(' ( a_expr | a_expr ',' | a_expr ',' ( ( a_expr ) ( ( ',' a_expr ) )* ) ) ')' ) ) ) ) ) ( ( ',' ( ( column_name '=' a_expr ) | ( '(' ( ( ( column_name ) ) ( ( ',' ( column_name ) ) )* ) ')' '=' ( '(' select_stmt ')' | ( '(' ')' | '(' ( a_expr | a_expr ',' | a_expr ',' ( ( a_expr ) ( ( ',' a_expr ) )* ) ) ')' ) ) ) ) ) )* ) ( ( 'WHERE' a_expr ) | ) ( sort_clause | ) ( limit_clause | ) ( 'RETURNING' target_list | 'RETURNING' 'NOTHING' | )
12 changes: 8 additions & 4 deletions pkg/ccl/importccl/read_import_mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,16 @@ func mysqlColToCockroach(
def.Type = coltypes.JSON

case mysqltypes.Set:
fallthrough
return nil, pgerror.UnimplementedWithIssueHintError(32560,
"cannot import SET columns at this time",
"try converting the column to a 64-bit integer before import")
case mysqltypes.Geometry:
fallthrough
return nil, pgerror.UnimplementedWithIssueErrorf(32559,
"cannot import GEOMETRY columns at this time")
case mysqltypes.Bit:
// TODO(dt): is our type close enough to use here?
fallthrough
return nil, pgerror.UnimplementedWithIssueHintError(32561,
"cannot improt BIT columns at this time",
"try converting the column to a 64-bit integer before import")
default:
return nil, pgerror.Unimplemented(fmt.Sprintf("import.mysqlcoltype.%s", typ), "unsupported mysql type %q", col.Type)
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/cmd/docgen/diagrams.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ var specs = []stmtSpec{
},
{
name: "delete_stmt",
inline: []string{"opt_with_clause", "with_clause", "cte_list", "table_name_expr_opt_alias_idx", "table_name_expr_with_index", "where_clause", "returning_clause", "opt_sort_clause", "opt_limit_clause"},
inline: []string{"opt_with_clause", "with_clause", "cte_list", "table_name_expr_opt_alias_idx", "table_name_expr_with_index", "opt_where_clause", "where_clause", "returning_clause", "opt_sort_clause", "opt_limit_clause"},
replace: map[string]string{
"relation_expr": "table_name",
},
Expand Down Expand Up @@ -788,7 +788,7 @@ var specs = []stmtSpec{
},
{
name: "on_conflict",
inline: []string{"opt_conf_expr", "name_list", "where_clause", "set_clause_list", "insert_column_list",
inline: []string{"opt_conf_expr", "name_list", "opt_where_clause", "where_clause", "set_clause_list", "insert_column_list",
"insert_column_item", "set_clause", "single_set_clause", "multiple_set_clause", "in_expr", "expr_list",
"expr_tuple1_ambiguous", "tuple1_ambiguous_values"},
replace: map[string]string{
Expand Down Expand Up @@ -968,7 +968,7 @@ var specs = []stmtSpec{
},
{
name: "simple_select_clause",
inline: []string{"opt_all_clause", "distinct_clause", "distinct_on_clause", "opt_as_of_clause", "as_of_clause", "expr_list", "target_list", "from_clause", "where_clause", "group_clause", "having_clause", "window_clause", "from_list"},
inline: []string{"opt_all_clause", "distinct_clause", "distinct_on_clause", "opt_as_of_clause", "as_of_clause", "expr_list", "target_list", "from_clause", "opt_where_clause", "where_clause", "group_clause", "having_clause", "window_clause", "from_list"},
unlink: []string{"index_name"},
nosplit: true,
},
Expand Down Expand Up @@ -1200,6 +1200,7 @@ var specs = []stmtSpec{
"expr_list",
"expr_tuple1_ambiguous",
"tuple1_ambiguous_values",
"opt_where_clause",
"where_clause",
"opt_sort_clause",
"returning_clause",
Expand Down
12 changes: 6 additions & 6 deletions pkg/server/updates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,12 @@ func TestReportUsage(t *testing.T) {
"test.b": 2,
"test.c": 3,

"unimplemented.pg_catalog.pg_stat_wal_receiver": 10,
"unimplemented.syntax.alter table rename constraint": 10,
"unimplemented.syntax.interval with precision": 10,
"unimplemented.#9148": 10,
"internalerror.": 10,
"othererror.builtins.go": 10,
"unimplemented.pg_catalog.pg_stat_wal_receiver": 10,
"unimplemented.syntax.#32555": 10,
"unimplemented.syntax.#32564": 10,
"unimplemented.#9148": 10,
"internalerror.": 10,
"othererror.builtins.go": 10,
"othererror." +
pgerror.CodeDataExceptionError +
".crdb_internal.set_vmodule()": 10,
Expand Down
12 changes: 7 additions & 5 deletions pkg/sql/alter_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ func (n *alterTableNode) startExec(params runParams) error {
case *tree.AlterTableAddColumn:
d := t.ColumnDef
if len(d.CheckExprs) > 0 {
return pgerror.Unimplemented(
"alter add check", "adding a CHECK constraint via ALTER not supported")
return pgerror.UnimplementedWithIssueError(29639,
"adding a CHECK constraint via ALTER not supported")
}
if d.HasFKConstraint() {
return pgerror.Unimplemented(
"alter add fk", "adding a REFERENCES constraint via ALTER not supported")
return pgerror.UnimplementedWithIssueError(8855,
"adding a REFERENCES constraint via ALTER not supported")
}

newDef, seqDbDesc, seqName, seqOpts, err := params.p.processSerialInColumnDef(params.ctx, d, tn)
Expand Down Expand Up @@ -715,7 +715,9 @@ func applyColumnMutation(
case schemachange.ColumnConversionTrivial:
col.Type = nextType
default:
return pgerror.Unimplemented("alter column type", "type conversion not yet implemented")
return pgerror.UnimplementedWithIssueDetailError(9851,
fmt.Sprintf("%s->%s", col.Type.SQLString(), nextType.SQLString()),
"type conversion not yet implemented")
}

case *tree.AlterTableSetDefault:
Expand Down
20 changes: 20 additions & 0 deletions pkg/sql/err_count_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,23 @@ func TestErrorCounts(t *testing.T) {
t.Fatalf("expected 1 syntax error, got %d", count3-count2)
}
}

func TestUnimplementedCounts(t *testing.T) {
defer leaktest.AfterTest(t)()

params, _ := tests.CreateTestServerParams()
s, db, _ := serverutils.StartServer(t, params)
defer s.Stopper().Stop(context.TODO())

if _, err := db.Exec("CREATE TABLE t(x INT)"); err != nil {
t.Fatal(err)
}

if _, err := db.Exec("ALTER TABLE t ALTER COLUMN x SET DATA TYPE STRING USING x::STRING"); err == nil {
t.Fatal("expected error, got no error")
}

if telemetry.GetFeatureCounts()["unimplemented.#9851.INT->STRING"] == 0 {
t.Fatal("expected unimplemented telemetry, got nothing")
}
}
44 changes: 31 additions & 13 deletions pkg/sql/parser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2569,9 +2569,9 @@ func TestUnimplementedSyntax(t *testing.T) {
issue int
expected string
}{
{`ALTER TABLE a ALTER CONSTRAINT foo`, 0, `alter constraint`},
{`ALTER TABLE a ALTER CONSTRAINT foo`, 31632, `alter constraint`},
{`ALTER TABLE a ALTER b SET NOT NULL`, 28751, ``},
{`ALTER TABLE a RENAME CONSTRAINT b TO c`, 0, `alter table rename constraint`},
{`ALTER TABLE a RENAME CONSTRAINT b TO c`, 32555, ``},

{`COMMENT ON COLUMN a.b IS 'a'`, 19472, `column`},
{`COMMENT ON DATABASE a IS 'b'`, 19472, ``},
Expand Down Expand Up @@ -2624,7 +2624,7 @@ func TestUnimplementedSyntax(t *testing.T) {
{`DISCARD TEMPORARY`, 0, `discard temp`},

{`SET CONSTRAINTS foo`, 0, `set constraints`},
{`SET LOCAL foo = bar`, 0, `set local`},
{`SET LOCAL foo = bar`, 32562, ``},
{`SET foo FROM CURRENT`, 0, `set from current`},

{`CREATE TEMP TABLE a(b INT)`, 5807, ``},
Expand All @@ -2640,9 +2640,9 @@ func TestUnimplementedSyntax(t *testing.T) {
{`CREATE TABLE a AS SELECT b WITH NO DATA`, 0, `create table as with no data`},

{`CREATE TABLE a(b INT AS (123) VIRTUAL)`, 0, `virtual computed columns`},
{`CREATE TABLE a(b INT REFERENCES c(x) MATCH FULL`, 0, `references match full`},
{`CREATE TABLE a(b INT REFERENCES c(x) MATCH PARTIAL`, 0, `references match partial`},
{`CREATE TABLE a(b INT REFERENCES c(x) MATCH SIMPLE`, 0, `references match simple`},
{`CREATE TABLE a(b INT REFERENCES c(x) MATCH FULL`, 20305, `match full`},
{`CREATE TABLE a(b INT REFERENCES c(x) MATCH PARTIAL`, 20305, `match partial`},
{`CREATE TABLE a(b INT REFERENCES c(x) MATCH SIMPLE`, 20305, `match simple`},

{`CREATE TABLE a(b INT, FOREIGN KEY (b) REFERENCES c(x) DEFERRABLE)`, 31632, `deferrable`},
{`CREATE TABLE a(b INT, FOREIGN KEY (b) REFERENCES c(x) INITIALLY DEFERRED)`, 31632, `initially deferred`},
Expand Down Expand Up @@ -2676,7 +2676,7 @@ func TestUnimplementedSyntax(t *testing.T) {
{`CREATE INDEX a ON b(foo(c))`, 9682, ``},

{`INSERT INTO foo(a, a.b) VALUES (1,2)`, 27792, ``},
{`INSERT INTO foo VALUES (1,2) ON CONFLICT ON CONSTRAINT a DO NOTHING`, 0, `on conflict on constraint`},
{`INSERT INTO foo VALUES (1,2) ON CONFLICT ON CONSTRAINT a DO NOTHING`, 28161, ``},

{`SELECT * FROM ab, LATERAL (SELECT * FROM kv)`, 24560, `select`},
{`SELECT * FROM ab, LATERAL foo(a)`, 24560, `srf`},
Expand All @@ -2685,18 +2685,34 @@ func TestUnimplementedSyntax(t *testing.T) {
{`SELECT * FROM a FOR UPDATE`, 6583, ``},
{`SELECT * FROM ROWS FROM (a(b) AS (d))`, 0, `ROWS FROM with col_def_list`},

{`SELECT 123 AT TIME ZONE 'b'`, 32005, ``},

{`SELECT 'a'::INTERVAL SECOND`, 0, `interval with unit qualifier`},
{`SELECT 'a'::INTERVAL(123)`, 0, `interval with precision`},
{`SELECT 'a'::INTERVAL SECOND(123)`, 0, `interval second with precision`},
{`SELECT 123 AT TIME ZONE 'b'`, 0, `at tz`},
{`SELECT 'a'::INTERVAL(123)`, 32564, ``},
{`SELECT 'a'::INTERVAL SECOND(123)`, 32564, `interval second`},
{`SELECT INTERVAL(3) 'a'`, 32564, ``},

{`SELECT 'a'::TIMESTAMP(123)`, 32098, ``},
{`SELECT 'a'::TIMESTAMP(123) WITHOUT TIME ZONE`, 32098, ``},
{`SELECT 'a'::TIMESTAMPTZ(123)`, 32098, ``},
{`SELECT 'a'::TIMESTAMP(123) WITH TIME ZONE`, 32098, ``},
{`SELECT TIMESTAMP(3) 'a'`, 32098, ``},
{`SELECT TIMESTAMPTZ(3) 'a'`, 32098, ``},

{`SELECT 'a'::TIME(123)`, 32565, ``},
{`SELECT 'a'::TIME(123) WITHOUT TIME ZONE`, 32565, ``},
{`SELECT 'a'::TIMETZ(123)`, 26097, `type with precision`},
{`SELECT 'a'::TIME(123) WITH TIME ZONE`, 32565, ``},
{`SELECT TIME(3) 'a'`, 32565, ``},
{`SELECT TIMETZ(3) 'a'`, 26097, `type with precision`},

{`SELECT a(b) 'c'`, 0, `a(...) SCONST`},
{`SELECT (a,b) OVERLAPS (c,d)`, 0, `overlaps`},
{`SELECT UNIQUE (SELECT b)`, 0, `UNIQUE predicate`},
{`SELECT a(b) 'c'`, 0, `func const`},
{`SELECT INTERVAL(3) 'a'`, 0, `expr_const const_interval`},
{`SELECT GROUPING (a,b,c)`, 0, `d_expr grouping`},
{`SELECT a(VARIADIC b)`, 0, `variadic`},
{`SELECT a(b, c, VARIADIC b)`, 0, `variadic`},
{`SELECT COLLATION FOR (a)`, 0, `func_expr_common_subexpr collation for`},
{`SELECT COLLATION FOR (a)`, 32563, ``},
{`SELECT CURRENT_TIME`, 26097, `current_time`},
{`SELECT CURRENT_TIME()`, 26097, `current_time`},
{`SELECT TREAT (a AS INT)`, 0, `treat`},
Expand All @@ -2720,6 +2736,8 @@ func TestUnimplementedSyntax(t *testing.T) {
{`CREATE TABLE a(b XML)`, 0, `xml`},
{`CREATE TABLE a(b TIMETZ)`, 26097, `type`},

{`INSERT INTO a VALUES (1) ON CONFLICT (x) WHERE x > 3 DO NOTHING`, 32557, ``},

{`WITH RECURSIVE a AS (TABLE b) SELECT c`, 21085, ``},

{`UPDATE foo SET (a, a.b) = (1, 2)`, 27792, ``},
Expand Down
Loading

0 comments on commit a36a9a7

Please sign in to comment.