Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: taozhi8833998/node-sql-parser
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5.3.2
Choose a base ref
...
head repository: taozhi8833998/node-sql-parser
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5.3.3
Choose a head ref

Commits on Aug 22, 2024

  1. build(deps-dev): bump @babel/preset-env from 7.25.3 to 7.25.4

    Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.25.3 to 7.25.4.
    - [Release notes](https://github.com/babel/babel/releases)
    - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
    - [Commits](https://github.com/babel/babel/commits/v7.25.4/packages/babel-preset-env)
    
    ---
    updated-dependencies:
    - dependency-name: "@babel/preset-env"
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Aug 22, 2024
    Copy the full SHA
    3cdc31f View commit details

Commits on Sep 1, 2024

  1. build(deps-dev): bump elliptic from 6.5.5 to 6.5.7

    Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.5 to 6.5.7.
    - [Commits](indutny/elliptic@v6.5.5...v6.5.7)
    
    ---
    updated-dependencies:
    - dependency-name: elliptic
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 1, 2024
    Copy the full SHA
    fb67850 View commit details

Commits on Sep 2, 2024

  1. Copy the full SHA
    ac446c4 View commit details

Commits on Sep 3, 2024

  1. Merge pull request #2095 from taozhi8833998/fix-limit-snowflake

    fix: limit as keyword in snowflake
    taozhi8833998 authored Sep 3, 2024
    Copy the full SHA
    c95594a View commit details
  2. build(deps-dev): bump eslint-plugin-import from 2.29.1 to 2.30.0

    Bumps [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) from 2.29.1 to 2.30.0.
    - [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
    - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
    - [Commits](import-js/eslint-plugin-import@v2.29.1...v2.30.0)
    
    ---
    updated-dependencies:
    - dependency-name: eslint-plugin-import
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 3, 2024
    Copy the full SHA
    b68e476 View commit details

Commits on Sep 4, 2024

  1. Copy the full SHA
    d03bab3 View commit details

Commits on Sep 5, 2024

  1. Merge pull request #2097 from taozhi8833998/feat-start-transaction-pg

    feat: support start transaction in pg
    taozhi8833998 authored Sep 5, 2024
    Copy the full SHA
    41a5693 View commit details
  2. Copy the full SHA
    abce7d7 View commit details
  3. Merge pull request #2100 from taozhi8833998/fix-text-length-mysql

    fix: text data type can have length setting in mysql
    taozhi8833998 authored Sep 5, 2024
    Copy the full SHA
    1421fbe View commit details
  4. Copy the full SHA
    a547abd View commit details

Commits on Sep 6, 2024

  1. Merge pull request #2102 from taozhi8833998/fix-over-partition-after-…

    …function-snowflake
    
    fix: over partition clause after func call in snowflake
    taozhi8833998 authored Sep 6, 2024
    Copy the full SHA
    9695140 View commit details
  2. Copy the full SHA
    48ce188 View commit details

Commits on Sep 7, 2024

  1. Merge pull request #2103 from taozhi8833998/fix-convert-signed-mysql

    fix: convert function to signed in mysql
    taozhi8833998 authored Sep 7, 2024
    Copy the full SHA
    305de82 View commit details
  2. Copy the full SHA
    cc75c88 View commit details

Commits on Sep 8, 2024

  1. Merge pull request #2106 from taozhi8833998/fix-convert-chinese-trans…

    …actsql
    
    fix: convert function and as chinese chars in transactsql
    taozhi8833998 authored Sep 8, 2024
    Copy the full SHA
    3a9f18b View commit details

Commits on Sep 9, 2024

  1. Copy the full SHA
    71385a2 View commit details

Commits on Sep 10, 2024

  1. Merge pull request #2108 from taozhi8833998/fix-create-table-as-pg

    fix: create table as table defintion could be optional in pg
    taozhi8833998 authored Sep 10, 2024
    Copy the full SHA
    1dc6f55 View commit details
  2. Copy the full SHA
    11bd1bc View commit details

Commits on Sep 11, 2024

  1. Merge pull request #2109 from taozhi8833998/refactor-function-loc-all…

    …-dialects
    
    refactor: add loc property to func_call in all dialects
    taozhi8833998 authored Sep 11, 2024
    Copy the full SHA
    8dc3c89 View commit details
  2. Copy the full SHA
    05bb927 View commit details

Commits on Sep 12, 2024

  1. Merge pull request #2112 from taozhi8833998/fix-column-keyword-postgr…

    …esql
    
    fix: reserved keyword as column name in postgresql
    taozhi8833998 authored Sep 12, 2024
    Copy the full SHA
    fd81632 View commit details
  2. Copy the full SHA
    701405c View commit details
  3. build(deps-dev): bump @types/mocha from 10.0.7 to 10.0.8

    Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 10.0.7 to 10.0.8.
    - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
    - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)
    
    ---
    updated-dependencies:
    - dependency-name: "@types/mocha"
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 12, 2024
    Copy the full SHA
    1aeab39 View commit details

Commits on Sep 13, 2024

  1. Merge pull request #2114 from taozhi8833998/feat-position-redshift

    feat: support position function in redshift
    taozhi8833998 authored Sep 13, 2024
    Copy the full SHA
    fb699cc View commit details

Commits on Sep 14, 2024

  1. Copy the full SHA
    ac9a674 View commit details

Commits on Sep 15, 2024

  1. Merge pull request #2116 from taozhi8833998/refactor-mediumint-pg

    refactor: add mediumint in pg
    taozhi8833998 authored Sep 15, 2024
    Copy the full SHA
    b8ecd09 View commit details

Commits on Sep 16, 2024

  1. Merge pull request #2115 from taozhi8833998/dependabot/npm_and_yarn/t…

    …ypes/mocha-10.0.8
    
    build(deps-dev): bump @types/mocha from 10.0.7 to 10.0.8
    taozhi8833998 authored Sep 16, 2024
    Copy the full SHA
    f60dab5 View commit details

Commits on Sep 17, 2024

  1. Merge pull request #2096 from taozhi8833998/dependabot/npm_and_yarn/e…

    …slint-plugin-import-2.30.0
    
    build(deps-dev): bump eslint-plugin-import from 2.29.1 to 2.30.0
    taozhi8833998 authored Sep 17, 2024
    Copy the full SHA
    9cc0b34 View commit details
  2. build(deps-dev): bump babel-loader from 8.3.0 to 8.4.1

    Bumps [babel-loader](https://github.com/babel/babel-loader) from 8.3.0 to 8.4.1.
    - [Release notes](https://github.com/babel/babel-loader/releases)
    - [Changelog](https://github.com/babel/babel-loader/blob/main/CHANGELOG.md)
    - [Commits](babel/babel-loader@v8.3.0...v8.4.1)
    
    ---
    updated-dependencies:
    - dependency-name: babel-loader
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 17, 2024
    Copy the full SHA
    33bbacc View commit details

Commits on Sep 18, 2024

  1. Copy the full SHA
    bba901e View commit details

Commits on Sep 19, 2024

  1. Merge pull request #2122 from taozhi8833998/feat-create-table-with-flink

    feat: support with clause in create table stmt for flink
    taozhi8833998 authored Sep 19, 2024
    Copy the full SHA
    48cf2d1 View commit details
  2. Copy the full SHA
    6a8f945 View commit details

Commits on Sep 20, 2024

  1. Merge pull request #2125 from taozhi8833998/fix-column-keyword-snowflake

    fix: limit as keyword in snowflake
    taozhi8833998 authored Sep 20, 2024
    Copy the full SHA
    04ec6cf View commit details
  2. Copy the full SHA
    c98cdf2 View commit details

Commits on Sep 21, 2024

  1. Merge pull request #2127 from taozhi8833998/fix-convert-expr-mysql

    fix: convert function with expr in mysql
    taozhi8833998 authored Sep 21, 2024
    Copy the full SHA
    f683373 View commit details

Commits on Sep 22, 2024

  1. Merge pull request #2121 from taozhi8833998/dependabot/npm_and_yarn/b…

    …abel-loader-8.4.1
    
    build(deps-dev): bump babel-loader from 8.3.0 to 8.4.1
    taozhi8833998 authored Sep 22, 2024
    Copy the full SHA
    465a891 View commit details

Commits on Sep 23, 2024

  1. Copy the full SHA
    6afe725 View commit details

Commits on Sep 24, 2024

  1. Copy the full SHA
    e401fe8 View commit details

Commits on Sep 25, 2024

  1. Merge pull request #2130 from taozhi8833998/feat-comment-on-pg

    feat: support comment on in pg
    taozhi8833998 authored Sep 25, 2024
    Copy the full SHA
    c6e9fc5 View commit details
  2. Copy the full SHA
    9456652 View commit details
  3. Merge pull request #2135 from taozhi8833998/fix-type-definition

    fix: add _next field to Select interface
    taozhi8833998 authored Sep 25, 2024
    Copy the full SHA
    c48216e View commit details
  4. Copy the full SHA
    7e9fc48 View commit details

Commits on Sep 26, 2024

  1. Merge pull request #2136 from taozhi8833998/fix-distinct-on-jsonb-pg

    fix: distinct on jsonb expr in pg
    taozhi8833998 authored Sep 26, 2024
    Copy the full SHA
    ef800f7 View commit details
  2. Copy the full SHA
    44801f7 View commit details

Commits on Sep 27, 2024

  1. Merge pull request #2138 from taozhi8833998/refactor-create-function-…

    …return-pg
    
    refactor: support return stmt sql body in create function in pg
    taozhi8833998 authored Sep 27, 2024
    Copy the full SHA
    600aeef View commit details
  2. Merge pull request #2092 from taozhi8833998/dependabot/npm_and_yarn/e…

    …lliptic-6.5.7
    
    build(deps-dev): bump elliptic from 6.5.5 to 6.5.7
    taozhi8833998 authored Sep 27, 2024
    Copy the full SHA
    107845f View commit details

Commits on Sep 29, 2024

  1. Merge pull request #2076 from taozhi8833998/dependabot/npm_and_yarn/b…

    …abel/preset-env-7.25.4
    
    build(deps-dev): bump @babel/preset-env from 7.25.3 to 7.25.4
    taozhi8833998 authored Sep 29, 2024
    Copy the full SHA
    feca67f View commit details

Commits on Oct 1, 2024

  1. 1
    Copy the full SHA
    7dbe232 View commit details

Commits on Oct 8, 2024

  1. Merge pull request #2147 from TonyGravagno/tg-pegjs-mod-operator

    Support 'mod' operator for mysql/mariadb
    taozhi8833998 authored Oct 8, 2024
    Copy the full SHA
    64eb1ee View commit details
  2. Copy the full SHA
    8d5761e View commit details
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -294,6 +294,9 @@ const tableList = parser.tableList('SELECT * FROM t', opt);

console.log(tableList); // ["select::null::t"]
```
- if the table name is prefixed with database name, the table name will be parsed as **dbName::tableName**
- if the table name is prefixed with database and schema name, the table name will be parsed as **dbName.schemaName::tableName**
- if the table name is prefixed with server name in TransactSQL, the table name will be parsed as **serverName.dbName.schemaName::tableName**

### Get the SQL visited columns

58 changes: 38 additions & 20 deletions ast/postgresql.ts
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

export type start = multiple_stmt | create_function_stmt;

export type cmd_stmt = drop_stmt | create_stmt | declare_stmt | truncate_stmt | rename_stmt | call_stmt | use_stmt | alter_stmt | set_stmt | lock_stmt | show_stmt | deallocate_stmt | grant_revoke_stmt | if_else_stmt | raise_stmt | execute_stmt | for_loop_stmt | transaction_stmt;
export type cmd_stmt = drop_stmt | create_stmt | declare_stmt | truncate_stmt | rename_stmt | call_stmt | use_stmt | alter_stmt | set_stmt | lock_stmt | show_stmt | deallocate_stmt | grant_revoke_stmt | if_else_stmt | raise_stmt | execute_stmt | for_loop_stmt | transaction_stmt | comment_on_stmt;

export type create_stmt = create_table_stmt | create_constraint_trigger | create_extension_stmt | create_index_stmt | create_sequence | create_db_stmt | create_domain_stmt | create_type_stmt | create_view_stmt | create_aggregate_stmt;

@@ -111,12 +111,12 @@ export type declare_stmt_t = { type: 'declare'; declare: declare_variable_item[]

export type declare_stmt = AstStatement<declare_stmt_t>;

export type create_func_opt = literal_string | { type: 'as'; begin?: string; declare?: declare_stmt; expr: multiple_stmt; end?: string; symbol: string; } | literal_numeric | { type: "set"; parameter: ident_name; value?: { prefix: string; expr: expr }};
export type create_func_opt = literal_string | { type: 'as'; begin?: string; declare?: declare_stmt; expr: multiple_stmt; end?: string; symbol: string; } | literal_numeric | { type: "set"; parameter: ident_name; value?: { prefix: string; expr: expr }} | return_stmt;

export type create_function_stmt_t = {
type: 'create';
replace?: string;
name: { schema?: string; name: string };
name: proc_func_name;
args?: alter_func_args;
returns?: func_returns;
keyword: 'function';
@@ -820,15 +820,37 @@ export interface for_loop_stmt_t {

export type for_loop_stmt = AstStatement<for_loop_stmt_t>;

export type transaction_mode_isolation_level = { type: 'origin'; value: string; } | ignore;

export type transaction_mode = { type: 'origin'; value: string; } | ignore;

export type transaction_mode_list = transaction_mode[];

export interface transaction_stmt_t {
type: 'transaction';
expr: {
type: 'origin',
value: string
action: {
type: 'origin',
value: string
};
keyword?: string;
modes?: transaction_mode[];
}
}

export type transaction_stmt = AstStatement<transaction_stmt_t>;
export type transaction_stmt = AstStatement<transaction_stmt_t> | ignore;

export type comment_on_option = { type: string; name: table_name; } | { type: string; name: column_ref; } | { type: string; name: ident; };

export type comment_on_is = { keyword: 'is'; expr: literal_string | literal_null; };

export interface comment_on_stmt_t {
type: 'comment';
target: comment_on_option;
expr: comment_on_is;
}

export type comment_on_stmt = AstStatement<comment_on_stmt_t>;

export interface select_stmt_node extends select_stmt_nake {
parentheses: true;
@@ -842,7 +864,7 @@ export type cte_definition = { name: { type: 'default'; value: string; }; stmt:

export type cte_column_definition = column_ref_list;

export type distinct_on = {type: string; columns: column_ref_list;} | { type: string | undefined; };
export type distinct_on = {type: string; columns: column_list_items;} | { type: string | undefined; };



@@ -866,7 +888,9 @@ export type option_clause = query_option[];

export type query_option = 'SQL_CALC_FOUND_ROWS'| 'SQL_CACHE'| 'SQL_NO_CACHE'| 'SQL_BIG_RESULT'| 'SQL_SMALL_RESULT'| 'SQL_BUFFER_RESULT';

export type column_clause = 'ALL' | '*' | column_list_item[] | column_list_item[];
export type column_list_items = column_list_item[];

export type column_clause = 'ALL' | '*' | column_list_item[] | column_list_items;

export type array_index = { brackets: boolean, number: number };

@@ -1448,6 +1472,8 @@ type KW_RECURSIVE = never;

type KW_REPLACE = never;

type KW_RETURN = never;

type KW_RETURNING = never;

type KW_RENAME = never;
@@ -1480,6 +1506,8 @@ type KW_TABLESPACE = never;

type KW_COLLATE = never;

type KW_COLLATION = never;

type KW_DEALLOCATE = never;

type KW_ON = never;
@@ -1628,6 +1656,8 @@ type KW_MEDIUMTEXT = never;

type KW_LONGTEXT = never;

type KW_MEDIUMINT = never;

type KW_BIGINT = never;

type KW_ENUM = never;
@@ -1734,8 +1764,6 @@ type KW_VAR_PRE_DOLLAR_DOUBLE = never;

type KW_VAR_PRE = never;

type KW_RETURN = never;

type KW_ASSIGN = never;

type KW_DOUBLE_COLON = never;
@@ -1899,8 +1927,6 @@ export type binary_type = data_type;

export type character_varying = string;



export type character_string_type = data_type;

export type numeric_type_suffix = any[];;
@@ -1921,16 +1947,10 @@ export type timezone = string[];;







export type time_type = data_type;





export type datetime_type = data_type | time_type;


@@ -1951,8 +1971,6 @@ export type serial_interval_type = data_type;





export type text_type = data_type;


Loading