pgsql-ast-parser icon indicating copy to clipboard operation
pgsql-ast-parser copied to clipboard

ALTER VIEW Fails

Open DVGY opened this issue 5 months ago • 0 comments

Error: Syntax error at line 1 col 12:

1  ALTER VIEW THEAA RENAME TO new_view_name;
              ^
Unexpected word token: "theaa". I did not expect any more input. Here is the state of my parse table:

    kw_index → %word ●
    kw_sequence → %word ●
    kw_type → %word ●

    at Parser.feed (F:\gitLocal\which-migration\node_modules\.pnpm\[email protected]\node_modules\nearley\lib\nearley.js:343:27)    at _parse (F:\gitLocal\which-migration\node_modules\.pnpm\[email protected]\node_modules\pgsql-ast-parser\index.js:1925:16)
    at doParse (F:\gitLocal\which-migration\node_modules\.pnpm\[email protected]\node_modules\pgsql-ast-parser\index.js:1880:27)
    at parse (F:\gitLocal\which-migration\node_modules\.pnpm\[email protected]\node_modules\pgsql-ast-parser\index.js:1883:11)
    at parseFirst (F:\gitLocal\which-migration\node_modules\.pnpm\[email protected]\node_modules\pgsql-ast-parser\index.js:1862:19)
    at Object.<anonymous> (F:\gitLocal\which-migration\packages\server\src\pg\controller\sqlexec\sqlexec.js:15:13)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12) {
  offset: 2,
  token: {
    type: 'word',
    value: 'theaa',
    text: 'THEAA',
    toString: [Function: tokenToString],
    offset: 11,
    lineBreaks: 0,
    line: 1,
    col: 12
  }
}

const { parseFirst } = require("pgsql-ast-parser"); const ast = parseFirst(ALTER VIEW THEAA RENAME TO new_view_name;);

DVGY avatar Sep 24 '24 18:09 DVGY