Ecosyste.ms: OpenCollective

An open API service for software projects hosted on Open Collective.

github.com/ivanceras/sql-ast

SQL abstract syntax tree
https://github.com/ivanceras/sql-ast

Merge pull request #36 from nickolay/strings

Clean up string-related variants in Token and Value

73f55fe1bb312c3f68deb274c3b38d531977ad07 authored almost 6 years ago by Andy Grove <[email protected]>
Merge pull request #38 from nickolay/remove-duplicate-tests

Remove sqlparser_generic.rs/sqlparser_postgres.rs duplication

ff897b90860fc7911ccb5e6984ea3b435b81d517 authored almost 6 years ago by Andy Grove <[email protected]>
Merge https://github.com/nickolay/sqlparser-rs/pull/1 from benesch/materialized

0621f8d43c19c626eaa413661186ea2a721c4392 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Re-run cargo fmt

f30ab89ad289f50084f68824e3aaa8abb945e5b4 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support CREATE MATERIALIZED VIEW

23a0fc79f5c5b9f23e25bd18ea57ab8e400f07a1 authored almost 6 years ago by Nikhil Benesch <[email protected]>
Support UNION/EXCEPT/INTERSECT

52e0f55b6f4d3330008ad1304d0270ba0f0bb6f6 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support CHAR synonym for CHARACTER

https://jakewheat.github.io/sql-overview/sql-2011-foundation-grammar.html#character-string-type

533775c0dad14e7065a5f33b97b980df5f81a8b4 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support NUMERIC without precision or scale

https://jakewheat.github.io/sql-overview/sql-2011-foundation-grammar.html#exact-numeric-type

23a0d032bde11538858b9ded98e3062048e91e5c authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support unary + / -

54c9ca86193d25fa29a2cd774a274bc9755dfabc authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support BETWEEN

786b1cf18abad4bfbee5966bc31e0225eeb0fca0 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support `AS` and qualified wildcards in SELECT

bed03abe44035c4b3d8e9f5d6acafcddd1a90463 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support basic CTEs (`WITH`)

Some unsupported features are noted as TODOs.

bf0c07bb1bfcfafec42e07cc6f4acd2b0eb5818f authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support IN

264319347dd6382ec9377a411f9c5fbedf5aa207 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
TBD fixup multiline comment tokenization

f958e9d3cf9cd2a8b8264dd9e93cf3bbe5c5cccd authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support comments in the tokenizer

028c613c3f4253a5ff9cb4a67380718a1b4969f6 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support national string literals (N'...')

Widely used in MS SQL and specified in ANSI.

35dd9342e2fa318be60b2dc5fb29d43eeb07680d authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support different quoting styles for delimited identifiers

The dialect information is from https://en.wikibooks.org/wiki/SQL_Dialects_Reference/Data_struct...

b9f4b503b669930ece92b55fa02a0c5550e66515 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Simplify quoted identifier tokenization

b3693bfa63f14dff5e4c60485e85f06d37a7fb14 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Small CLI app that can be used to test parsing an external SQL file

2e9da53ed3fce705df82defec5944981aae1e74c authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Update README to the recent changes in the AST

577e634f3c341dcb2c4252647c073af991d31c39 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support basic CREATE VIEW

0c0cbcaff4bfaca1d3e3512e5c44659ae084e20f authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Improve error messages in parse_create()

By not swallowing the Err from parse_data_type().

Also switch to `match` to enable parsing tabl...

346d1ff2e454d4df7b52798515c8609424e006f5 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Simplify parse_create() a little

Don't need the duplicate `columns.push()` + we advance the tokenizer,
so no need to peek first.

a0f625b94945211c7ae24fe02bf56f7ca079a9e8 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Fix a typo in parse_value error message

89602dc0448157941505eb04eb77419430d2ef9d authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Simplify JOIN USING (columns)

...by reusing `parse_column_names` instead of extracting identifiers
out of the `parse_expr_list...

b716ffb937170c8dde546878ee96b2cf16f6d3ac authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Assert when an unknown keyword was passed to parse_keyword()

This happens all the time when I forget to check that the keyword I wanted
to use is actually li...

05a70a358a20870554d9b71d82682d1c8e66f27b authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Switch some tests to `verified_select_stmt`

(the tests affected by "unboxing" in the previous commits.)

6b107065ac10dcd8cf92c38132f863e0da1545b5 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Don't Box<ASTNode> in SQLSelect

Instead change ASTNode::SQLSubquery to be Box<SQLSelect>

e3b981a0e2c1c76779957886106d3706fefd92e5 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Don't Box<ASTNode> in SQLStatement

This used to be needed when it was a variant in the ASTNode enum itself.

c5bbfc33fdcfe03031df873aca0f76a03b172d8f authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Remove Box<> from SQLOrderByExpr

It was probably copied from somewhere else when most types were variants
in ASTNode, and needed ...

3619e89e9c79f5fb70b967a7bb8d3d3f909deadf authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Move TableFactor to be a separate enum

ASTNode can now be renamed SQLExpression, as it represents a node in
the "expression" part of th...

9967031cbaed216460b8533d951321184c79697f authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Store original, quoted form in SQLIdent

Also move more things to use SQLIdent instead of String in the hope of
making it a newtype event...

e0ceacd1adeb67c802e81feb5f6770cc2e254ae6 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Improve DELETE FROM parsing (4.4/4.4)

Store (and parse) `table_name: SQLObjectName` instead of
`relation: Option<Box<ASTNode>>`, which...

07790fe4c4ecb2c4429e970a7d0231a41b5181d7 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Simplify by avoiding SQLCompoundIdentifier (4.3/4.4)

...instead make `parse_compound_identifier()` return the underlying
Vec<> directly, and rename i...

f5bd9c398fab9a1055e8e7553615a6d59cfdd383 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Rename parse_tablename -> parse_object_name (4.2/4.4)

...to match the name of the recently introduced `SQLObjectName` struct
and to avoid any reservat...

39e98cb11a0b960aff5233bb0474ebb9409c42b2 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Introduce SQLObjectName struct (4.1/4.4)

(To store "A name of a table, view, custom type, etc., possibly
multi-part, i.e. db.schema.obj"....

523f086be7913e88f4ab841bbbd9b45adf171f59 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Stricter parsing for subqueries (3/4)

This makes the parser more strict when handling SELECTs nested
somewhere in the main statement:
...

215820ef66e0e6c66c808daf9e5d4f03890e69e6 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Fix precedence for the NOT operator (2/4)

I checked the docs of a few of the most popular RDBMSes, and it seems
there's consensus that the...

82dc581639c069b9217f7a1efe2e5241846306d5 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support parsing of multiple statements (5/5)

Parser::parse_sql() can now parse a semicolon-separated list of
statements, returning them in a ...

707c58ad57baac0c4323886c92f0964fca00bc7d authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Simplify some tests by introducing `verified_select_stmt` and `expr_from_projection`

(The primary motivation was that it makes the tests more resilient to
the upcoming changes to th...

5a0e0ec928314827a8b5c1af519ed876420a03bd authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Stop losing parens when roundtripping (1/4)

Before this change an expression like `(a+b)-(c+d)` was parsed correctly
(as a Minus node with t...

29db6197927d4e5955cb442a595e1c7bde301f6b authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Only use parse_expr() when we expect an expression (0/4)

Before this commit there was a single `parse_expr(u8)` method, which
was called both

1) from wi...

b57c60a78c894c4f5d6d3621682aaaef25ef23de authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Separate statement from expr parsing (4/5)

Continuing from https://github.com/andygrove/sqlparser-rs/pull/33#issuecomment-453060427

This s...

2dec65fdb45f91d45b27f5a42b9e59daa698d43e authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Extract ASTNode::SQLSelect to a separate struct (1/5)

This will allow re-using it for SQLStatement in a later commit.

(Also split the new struct into...

d8173d4196d3a943d62b684053cf0b4d2f8c5654 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Move SQLOrderByExpr and Join* to query.rs (2/5)

45a5f844afee8eca26c8ce51aa57e1a4749dccb6 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Don't parse ORDER BY as a table alias (8/8)

50b5724c39ad922814091caa84e921dfc948f018 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Remove unused ASTNode::SQLAssignment variant (3/5)

The SQLAssignment *struct* is used directly in ASTNode::SQLUpdate (will
change to SQLStatement::...

7b86f5c842e612590ab25633c60b1cea0b9f8d3f authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support table aliases without `AS` (7/8)

...as in `FROM foo bar WHERE bar.x > 1`.

To avoid ambiguity as to whether a token is an alias o...

76ec175d20678771ee69e22b46b530d4b73217af authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Support `AS` table aliases (6/8)

A "table factor" (name borrowed from the ANSI SQL grammar) is a table
name or a derived table (s...

536fa6e428d733071c352fbd105388834197385a authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Further simplify parse_compound_identifier (5/8)

This part changes behavior:
- Fail when no identifier is found.
- Avoid rewinding if EOF was hit...

7bbf69f51390f2738af2ed6207f390ceddf91b64 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Remove dialect-specific keyword lists (2/8)

Now populating SQLWord.keyword based on the list of globally supported
keywords.

f87230553efda04a1b768063f6501af05b7cb40b authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Stop nesting `match` in parse_compound_identifier (4/8)

991fd19b87df60d433fd903c3e13a31418426b09 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Simplify by using expect_keyword / expect_token (3/8)

...instead of parse_keyword / consume_token - to reduce nesting of `if`s.

(Follow-up to PR #35)

8c3479969f4b67f8aaceade56c4fb23d5b908c91 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Rework keyword/identifier parsing (1/8)

Fold Token::{Keyword, Identifier, DoubleQuotedString} into one
Token::SQLWord, which has the nec...

9a8b6a8e6421ca07fb69b0054721068cd42a9708 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Make SQLOrderByExpr::asc tri-state

i.e. ASC/DESC/unspecified - so that we don't lose information about
source code.

Also don't tak...

3de2a0952cc4d1e6f78ebf3c1113d4d9cbd55729 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Join match arms for Keyword and binary ops

because they share implementation.

d73a1e0e1d14a419fa0d9609d271544518c721f9 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Stop returning Option from parse_infix

This reduces amount of boilerplate and avoids cloning the `expr` param.

eb4b5bc6864aa4ace9f63b95cf504aecc0a6d4d7 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Merge branches 'strings' and 'remove-duplicate-tests'

12b9f5aafc2846128d80205113e99d4d8c58dd24 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Use verified() in the remaining PG-specific tests

70c799e21d295d45bc707afa03bb3c42a5547923 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Remove duplicate tests from sqlparser_postgres.rs

These have identical copies in sqlparser_generic.rs

d5109a2880bedfe7cb10d684f3a9a926a4fb0b7c authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Move tests for "LIKE '%'" to sqlparser_generic.rs

...as this syntax is not specific to the PostgreSQL dialect.

Also use verified() to assert that...

9441f9c5d84f117b21a72a35a2123e99c3df7980 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Remove Value::DoubleQuotedString

...and parser support for the corresponding token, as "..." in SQL[*] is
not a literal string li...

56884dc7005ddd370d896f31c0c85094e05c550d authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Remove Value::String

Its existence alongside SingleQuotedString simply doesn't make sense:
`'a string'` is a string l...

078eb677a1f713cd01b73719864b47fcdc2c9c1c authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Remove Token::String, as it's never emitted

Indeed, given that there is Token::SingleQuotedString and
Token::Identifier, there's no other "s...

d0a65ffd053b68dd6841815ae5069f8563e32900 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Remove Token::Identifier match arm from parse_value

An identifier is not a literal value, and parse_value is not called on
such a token anyway.

efdbf0f9dc0560e749bab93a560ba2a2117a2a20 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Run all the 'generic' tests with the PostgreSqlDialect too.

45dab0e2d4553b4eb0fec0993128300e273e90a3 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Reduce differences between "generic" and "postgresql" tests

Mainly by replacing `assert_eq!(sql, ast.to_string())` with a call to
the recently introduced `v...

a1da7b40050bbdfa55cb5b88e0272e012350a781 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
(cargo-release) start next development iteration 0.2.2-alpha.0

82b14673243e5193c690a2cb50c009fac3a7fa87 authored almost 6 years ago by Andy Grove <[email protected]>
(cargo-release) version 0.2.1

bde2e2d660992215ba1309289b60fc6aae6f6704 authored almost 6 years ago by Andy Grove <[email protected]>
Merge pull request #35 from nickolay/consume-token

Clean up consume_token() and parse/expect_keyword()

47e00af15b6f0585c8dbd9726bf21eaebcdd6d66 authored almost 6 years ago by Andy Grove <[email protected]>
Return bool from consume_token(), mark as #[must_use]

ae06dc79016051e81c0edc0c34fac66a618039c7 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Introduce expect_token(), failing when the expected token was not found

fd9e2818d71f38990e80f2053877c41bf7a60c7f authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Fail when expected keyword is not found

Add #[must_use] to warn against unchecked results of parse_keyword/s in
the future.

de4ccd3cb7e89b533ccaae6038590188a44e7e0b authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Use expect_keyword() instead of consume_token() where appropriate

Before this missing keywords THEN/WHEN/AS would be parsed as if they
were in the text as the cod...

b3ab4aca88f71bd988f77edbe4c54c0ce66a98f4 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Don't consume a second DoubleColon in parse_pg_cast

The function is invoked after a DoubleColon was already matched.

89cfa9e5997ae017ae2fd5a1b8fe560ab22e18bd authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Fix a mistake in merge conflict resolution earlier

dce09f80542f0d0784af2f61240391fa0fa2c773 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
(cargo-release) start next development iteration 0.2.1-alpha.0

ac365bd44eda7e341848c864c663c9a1d445121b authored almost 6 years ago by Andy Grove <[email protected]>
(cargo-release) version 0.2.0

a987503b2ce09ff27f5bc4252f691d4a7c2a32f3 authored almost 6 years ago by Andy Grove <[email protected]>
Merge pull request #33 from andygrove/not

implement NOT

115c8e5595b1a0b61d1b12bc75c19a5f9e559f99 authored almost 6 years ago by Andy Grove <[email protected]>
specialized parser for DEFAULT expression in CREATE TABLE

c0cafb7308846f22558ba08e7179b2050c1608b2 authored almost 6 years ago by Andy Grove <[email protected]>
Merge branch 'master' into not

777fd4c2ee48a26c0b8c04ea3e1fe5f13dc40a85 authored almost 6 years ago by Andy Grove <[email protected]>
Merge branch 'fredrikroos-join-support'

a52b59e3ab6e064469c43e23a6e821c8b2d4f108 authored almost 6 years ago by Andy Grove <[email protected]>
fix regression

f8c6fa96f4d82c031bc14cadce174fa4457d1433 authored almost 6 years ago by Andy Grove <[email protected]>
Merge branch 'join-support' of https://github.com/fredrikroos/sqlparser-rs into fredrikroos-join-support

8c351fe10a9ef43f7cbcef3417e291e7b181e24c authored almost 6 years ago by Andy Grove <[email protected]>
Update README

32d53a6b7e0d95d36bc5c6fa0952849423cf337d authored almost 6 years ago by Andy Grove <[email protected]>
(cargo-release) start next development iteration 0.1.11-alpha.0

7233a7e71f8da3f73d31879650fe94fcfe746509 authored almost 6 years ago by Andy Grove <[email protected]>
(cargo-release) version 0.1.10

81954bffb844a6841e806bff119a158188f65a0c authored almost 6 years ago by Andy Grove <[email protected]>
Merge pull request #34 from nickolay/misc

Miscellaneous fixes

25718b8028ae22a7114b87ee41ed3b42a219fd83 authored almost 6 years ago by Andy Grove <[email protected]>
Merge branch 'master' into join-support

ab423bc9dc0e0c3f812985ab817a8faad367fe80 authored almost 6 years ago by Andy Grove <[email protected]>
Remove special handling of ::type1::type2 from parse_pg_cast

...it gets handled just as well by the infix parser.
(Add a test while we're at it.)

eff92a2dc1ec429c65cb6ec6b80489740c92419c authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Simplify custom datatypes handling and add a test

1) Simplified the bit in parse_datatype()
2) Made sure it was covered by the test (the "public.y...

f21cd697c3095840b52882b326dba21e9ddef055 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Fix parse_time() handling of fractional seconds

There's no Token::Period in such situation, so fractional part (from sec) was silently truncated...

3b13e153a8da17a38ed1bdf0c11dcaf47f620afb authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Simplify the {next|prev|peek}_token functions

Remove `pub` from the "internal" ones. Remove ones that duplicate each
other completely.

7c6e6970fad3a75cda2b2f624f9bc777099085fd authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Remove parse_function_or_pg_cast, since `fn(...) :: type` is taken care of in parse_infix()

52277c3025d65e6669e1e9b19948055383ca872f authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Combine multiple patterns with the same action in parse_prefix()

2873b0cee2ff886ea72cd827ed0e7f0129167da8 authored almost 6 years ago by Nickolay Ponomarev <[email protected]>
Implemented NOT LIKE

ee1944b9d94bd22f0da651b39dc6b433c45a00b3 authored about 6 years ago by Andy Grove <[email protected]>
rename rex to expr in ASTNode

5d62167d6e6a5506a35f4c1d709d67079d8fb80f authored about 6 years ago by Andy Grove <[email protected]>
implement NOT

7aab880387bf493b5fbafed9bccc282f4727dba8 authored about 6 years ago by Andy Grove <[email protected]>
(cargo-release) start next development iteration 0.1.10-alpha.0

2240dd09ffade8db5a068053fd1e07c6b054cb2b authored about 6 years ago by Andy Grove <[email protected]>
(cargo-release) version 0.1.9

d0b5d5e8824b56ce4bc85414bf78a5691b6687e1 authored about 6 years ago by Andy Grove <[email protected]>