Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,23 @@ type checking should allow us to give type errors without the user having to run

support more advanced lint rules

#### type check `create type t as range`

```sql
create type timerange as range (
subtype = time,
subtype_diff = time_subtype_diff
);
```

if set, `subtype_diff` must be of type `function time_subtype_diff(time without time zone, time without time zone)`

```ts
function createRangeType<T>(subtype: T, subtype_diff: (T, T) => float8)
```

https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-DEFINING

### PGO

- https://github.com/rust-lang/rust-analyzer/pull/19582#issue-2992471459
Expand Down Expand Up @@ -590,6 +607,26 @@ select '{"foo": 1,}'::json;
-- ^ invalid json, unexpected trailing comma
```

```sql
create type foo as (
a int8,
b int8
);
select foo '(1)';
-- ^ malformed record literal, missing column b
```

```sql
select '[1,,2)'::numrange;
-- ^ malformed range literal, extra comma

create table reservation (room int, during tsrange);
insert into reservation values
(1108, '[2010-01-01 14:30,, 2010-01-01 15:30)');
-- ^ malformed range literal, extra comma

```

### Rule: column label is the same as an existing column

```sql
Expand Down Expand Up @@ -772,6 +809,18 @@ select * from json_table(
);
```

#### `nextval`

```sql
-- via https://www.postgresql.org/docs/current/datatype-oid.html
nextval('foo') -- operates on sequence foo
nextval('FOO') -- same as above
nextval('"Foo"') -- operates on sequence Foo
nextval('myschema.foo') -- operates on myschema.foo
nextval('"myschema".foo') -- same as above
nextval('foo') -- searches search path for foo
```

### Autocomplete

- [datagrip postfix completion](https://blog.jetbrains.com/datagrip/2019/03/11/top-9-sql-features-of-datagrip-you-have-to-know/#postfix_completion)
Expand Down
2 changes: 2 additions & 0 deletions crates/squawk_ide/src/expand_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const DELIMITED_LIST_KINDS: &[SyntaxKind] = &[
SyntaxKind::REVOKE_COMMAND_LIST,
SyntaxKind::ROLE_LIST,
SyntaxKind::ROW_LIST,
SyntaxKind::XML_ATTRIBUTE_LIST,
SyntaxKind::XML_NAMESPACE_LIST,
SyntaxKind::SET_COLUMN_LIST,
SyntaxKind::SET_EXPR_LIST,
SyntaxKind::SET_OPTIONS_LIST,
Expand Down
44 changes: 43 additions & 1 deletion crates/squawk_parser/src/generated/syntax_kind.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading