Commit 3e72bb5
committed
Alias PostgreSQL
In PostgreSQL, `CREATE USER` and `ALTER USER` are aliases of `CREATE ROLE` and `ALTER ROLE` (with `LOGIN` defaulting to `true` for `USER`). The library rejects them with `"Expected: an object type after CREATE, found: USER"`.
Our previous approach added a `RoleKeyword` discriminator field to `CreateRole` / `AlterRole`, which upstream maintainers declined. A proper upstream fix would require unifying Snowflake's `CreateUser` with PostgreSQL's, which is too large a refactor for our needs.
We only need the statements to parse. Parsing them into `CreateRole` is semantically correct (they are aliases), and our downstream extractors already pattern-match on `CreateRole` for password redaction, so no AST changes or extractor changes are needed.
The only observable difference is that round-tripping a parsed `CREATE USER` statement renders it back as `CREATE ROLE`, but we do not rely on round-trip fidelity anywhere (and datafusion-sqlparser-rs doesn't guarantee round-trips anyway).CREATE/ALTER USER to CREATE/ALTER ROLE
1 parent 234503c commit 3e72bb5
1 file changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5172 | 5172 | | |
5173 | 5173 | | |
5174 | 5174 | | |
5175 | | - | |
| 5175 | + | |
| 5176 | + | |
| 5177 | + | |
| 5178 | + | |
| 5179 | + | |
| 5180 | + | |
| 5181 | + | |
| 5182 | + | |
| 5183 | + | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
| 5188 | + | |
5176 | 5189 | | |
5177 | 5190 | | |
5178 | 5191 | | |
| |||
10767 | 10780 | | |
10768 | 10781 | | |
10769 | 10782 | | |
10770 | | - | |
| 10783 | + | |
| 10784 | + | |
| 10785 | + | |
| 10786 | + | |
| 10787 | + | |
| 10788 | + | |
| 10789 | + | |
| 10790 | + | |
10771 | 10791 | | |
10772 | 10792 | | |
10773 | 10793 | | |
| |||
0 commit comments