pgsql-ast-parser
Advanced tools
Comparing version 10.5.2 to 11.0.0
@@ -30,2 +30,3 @@ import * as a from './syntax/ast'; | ||
alterTable?: (st: a.AlterTableStatement) => a.Statement | nil; | ||
alterIndex?: (st: a.AlterIndexStatement) => a.Statement | nil; | ||
tableAlteration?: (change: a.TableAlteration, table: a.QNameAliased) => a.TableAlteration | nil; | ||
@@ -177,2 +178,3 @@ dropColumn?: (change: a.TableAlterationDropColumn, table: a.QNameAliased) => a.TableAlteration | nil; | ||
deallocate(st: a.DeallocateStatement): a.Statement | nil; | ||
alterIndex(st: a.AlterIndexStatement): a.Statement | nil; | ||
alterTable(st: a.AlterTableStatement): a.Statement | nil; | ||
@@ -196,3 +198,3 @@ tableAlteration(change: a.TableAlteration, table: a.QNameAliased): a.TableAlteration | nil; | ||
selection(val: a.SelectFromStatement): a.SelectStatement | nil; | ||
orderBy(orderBy: a.OrderByStatement[] | null | undefined): a.OrderByStatement[] | null | undefined; | ||
orderBy(orderBy: a.OrderByStatement[] | null | undefined): nil | a.OrderByStatement[]; | ||
union(val: a.SelectFromUnion): a.SelectStatement | nil; | ||
@@ -199,0 +201,0 @@ with(val: a.WithStatement): a.SelectStatement | nil; |
@@ -9,3 +9,3 @@ interface NearleyToken { | ||
save: () => any; | ||
formatError: (token: NearleyToken) => string; | ||
formatError: (token: never) => string; | ||
has: (tokenType: string) => boolean; | ||
@@ -12,0 +12,0 @@ } |
@@ -9,3 +9,3 @@ interface NearleyToken { | ||
save: () => any; | ||
formatError: (token: NearleyToken) => string; | ||
formatError: (token: never) => string; | ||
has: (tokenType: string) => boolean; | ||
@@ -12,0 +12,0 @@ } |
@@ -9,3 +9,3 @@ interface NearleyToken { | ||
save: () => any; | ||
formatError: (token: NearleyToken) => string; | ||
formatError: (token: never) => string; | ||
has: (tokenType: string) => boolean; | ||
@@ -12,0 +12,0 @@ } |
@@ -9,3 +9,3 @@ interface NearleyToken { | ||
save: () => any; | ||
formatError: (token: NearleyToken) => string; | ||
formatError: (token: never) => string; | ||
has: (tokenType: string) => boolean; | ||
@@ -12,0 +12,0 @@ } |
{ | ||
"name": "pgsql-ast-parser", | ||
"version": "10.5.2", | ||
"version": "11.0.0", | ||
"description": "Yet another simple Postgres SQL parser/modifier", | ||
@@ -16,3 +16,3 @@ "main": "index.js", | ||
"build:deno": "rimraf .deno && node ./deno-transpile.js --copy && npm run deno:gen && node ./deno-transpile.js --process", | ||
"test": "mochapack src/**/*.spec.ts", | ||
"test": "find src -iname '*.spec.ts' | xargs mochapack", | ||
"cover": "cross-env NODE_ENV=coverage nyc --reporter=lcov --reporter=text npm run test" | ||
@@ -68,9 +68,9 @@ }, | ||
"source-map-support": "^0.5.19", | ||
"ts-loader": "^8.0.0", | ||
"ts-node": "^8.10.2", | ||
"ts-loader": "^8.0.0", | ||
"typescript": "^3.9.6", | ||
"typescript": "^4.7.4", | ||
"vscode-mocha-hmr": "^1.0.0", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.12", | ||
"webpack-dev-server": "^3.11.0", | ||
"webpack-dev-server": "^4.10.0", | ||
"webpack-node-externals": "^1.7.2" | ||
@@ -77,0 +77,0 @@ }, |
@@ -225,2 +225,17 @@ import 'mocha'; | ||
it('removes WITH node if one of its contained statements is removed', () => { | ||
// create a mapper | ||
const mapper = astMapper(map => ({ | ||
statement: s => { | ||
return (s.type !== 'select' && s.type !== 'with') ? null : map.super().statement(s) | ||
}, | ||
})); | ||
// process sql | ||
const killed = mapper.statement(parse('with ids as (select id from t1) delete from t1 where 1=1 returning id')); | ||
assert.isNull(killed, 'default mapper maps a WITH to null if its contained `in` statement gets mapped to null'); | ||
const survived = mapper.statement(parse('with ids as (select id from t1) select * from ids')); | ||
assert.equal(toSql.statement(survived!), 'WITH ids AS (SELECT id FROM t1 ) SELECT * FROM ids'); | ||
}); | ||
it('maps insert with super() call', () => { | ||
@@ -227,0 +242,0 @@ |
@@ -33,2 +33,3 @@ import * as a from './syntax/ast'; | ||
alterTable?: (st: a.AlterTableStatement) => a.Statement | nil | ||
alterIndex?: (st: a.AlterIndexStatement) => a.Statement | nil | ||
tableAlteration?: (change: a.TableAlteration, table: a.QNameAliased) => a.TableAlteration | nil | ||
@@ -220,2 +221,4 @@ dropColumn?: (change: a.TableAlterationDropColumn, table: a.QNameAliased) => a.TableAlteration | nil | ||
return this.alterTable(val); | ||
case 'alter index': | ||
return this.alterIndex(val); | ||
case 'commit': | ||
@@ -261,2 +264,3 @@ case 'start transaction': | ||
case 'drop type': | ||
case 'drop trigger': | ||
return this.drop(val); | ||
@@ -486,3 +490,18 @@ case 'create enum': | ||
const returning = arrayNilMap(val.returning, c => this.selectionColumn(c)); | ||
const onConflictOn = arrayNilMap(val.onConflict?.on, e => this.expr(e)); | ||
let on = val.onConflict?.on; | ||
switch (on?.type) { | ||
case 'on constraint': | ||
// nothing to do | ||
break; | ||
case 'on expr': | ||
on = assignChanged(on, { | ||
exprs: arrayNilMap(on.exprs, e => this.expr(e)), | ||
}); | ||
break; | ||
case null: | ||
case undefined: | ||
break; | ||
default: | ||
throw NotSupported.never(on); | ||
} | ||
let ocdo = val.onConflict?.do; | ||
@@ -504,3 +523,3 @@ if (ocdo && ocdo !== 'do nothing') { | ||
do: ocdo, | ||
on: onConflictOn, | ||
on, | ||
}), | ||
@@ -686,2 +705,11 @@ }); | ||
// ========================================= | ||
// ============== ALTER INDEX ============== | ||
// ========================================= | ||
alterIndex(st: a.AlterIndexStatement): a.Statement | nil { | ||
// not much as of today...might improve this in the future | ||
return st; | ||
} | ||
// ========================================= | ||
// ============== ALTER TABLE ============== | ||
@@ -688,0 +716,0 @@ // ========================================= |
@@ -31,2 +31,47 @@ import 'mocha'; | ||
it('comments and minus are not confused', () => { | ||
lexer.reset(`1 - 2`); | ||
next({ type: 'int', value: '1' }); | ||
next({ type: 'op_minus' }); | ||
next({ type: 'int', value: '2' }); | ||
lexer.reset(`1 -- 2`); | ||
next({ type: 'int', value: '1' }); | ||
expect(lexer.next()).to.equal(undefined) | ||
}); | ||
it('member and minus ops are not confused', () => { | ||
lexer.reset(`- -> ->>`); | ||
next({ type: 'op_minus'}); | ||
next({ type: 'op_member'}); | ||
next({ type: 'op_membertext'}); | ||
}); | ||
it('comments and division are not confused', () => { | ||
lexer.reset(`1 / 2`); | ||
next({ type: 'int', value: '1' }); | ||
next({ type: 'op_div' }); | ||
next({ type: 'int', value: '2' }); | ||
lexer.reset(`1 /* 2 */`); | ||
next({ type: 'int', value: '1' }); | ||
expect(lexer.next()).to.equal(undefined) | ||
}); | ||
it('like/ilike ops', () => { | ||
lexer.reset(`!~~*`); | ||
next({ type: 'op_not_ilike' }); | ||
lexer.reset(`!~~ *`); | ||
next({ type: 'op_not_like' }); | ||
next({ type: 'star' }); | ||
lexer.reset(`~~*`); | ||
next({ type: 'op_ilike' }); | ||
lexer.reset(`~~ *`); | ||
next({ type: 'op_like' }); | ||
next({ type: 'star' }); | ||
}); | ||
it('tokenizes end comment', () => { | ||
@@ -57,2 +102,9 @@ lexer.reset(`SELECT -- test`); | ||
it('allows punctuation in keyords', () => { | ||
// see https://github.com/oguimbal/pgsql-ast-parser/issues/100 | ||
lexer.reset(`SELECT /* :,| */ *`); | ||
next({ type: 'kw_select' }); | ||
next({ type: 'star' }); | ||
}); | ||
it('tokenizes select', () => { | ||
@@ -59,0 +111,0 @@ lexer.reset(`SELECT * FROM test`); |
@@ -49,3 +49,3 @@ import { compile, keywords, Token } from 'moo'; | ||
commentLine: /\-\-.*?$[\s\r\n]*/, | ||
commentFullOpen: /(?<!\/)\/\*/, | ||
commentFullOpen: /\/\*/, | ||
commentFullClose: /\*\/[\s\r\n]*/, | ||
@@ -65,2 +65,3 @@ star: '*', | ||
op_cast: '::', | ||
op_colon: ':', | ||
op_plus: '+', | ||
@@ -72,12 +73,12 @@ op_eq: '=', | ||
}, | ||
op_minus: /(?<!\-)\-(?!\-)(?!\>)/, | ||
op_div: /(?<!\/)\/(?!\/)/, | ||
op_like: /(?<!\!)~~(?!\*)/, // ~~ =LIKE | ||
op_ilike: /(?<!\!)~~\*/, // ~~* =ILIKE | ||
op_not_like: /\!~~(?!\*)/, // !~~ =LIKE | ||
op_membertext: '->>', | ||
op_member: '->', | ||
op_minus: '-', | ||
op_div: /\//, | ||
op_not_ilike: /\!~~\*/, // !~~* =ILIKE | ||
op_not_like: /\!~~/, // !~~ =LIKE | ||
op_ilike: /~~\*/, // ~~* =ILIKE | ||
op_like: /~~/, // ~~ =LIKE | ||
op_mod: '%', | ||
op_exp: '^', | ||
op_member: /\-\>(?!\>)/, | ||
op_membertext: '->>', | ||
op_additive: { | ||
@@ -90,3 +91,3 @@ // group other additive operators | ||
// ... to add: "IN" and "NOT IN" that are matched by keywords | ||
match: ['>', '>=', '<', '<=', '@>', '<@', '?', '?|', '?&', '#>>', '>>', '<<', '~'], | ||
match: ['>', '>=', '<', '<=', '@>', '<@', '?', '?|', '?&', '#>>', '>>', '<<', '~', '~*', '!~', '!~*'], | ||
}, | ||
@@ -93,0 +94,0 @@ ops_others: { |
@@ -63,3 +63,3 @@ import { Statement, Expr, QName, GeometricLiteral, Point, Line, Segment, Box, Path, Polygon, Circle, Interval, PGComment } from './syntax/ast'; | ||
// always return an array of statements. | ||
if (!entry && !Array.isArray(parsed)) { | ||
if (typeof optEntry !== 'string' && !Array.isArray(parsed)) { | ||
parsed = [parsed] | ||
@@ -124,6 +124,6 @@ } | ||
} catch (e) { | ||
if (typeof e?.message !== 'string') { | ||
if (typeof (e as any)?.message !== 'string') { | ||
throw e; | ||
} | ||
let msg: string = e.message; | ||
let msg: string = (e as any).message; | ||
// remove all the stack crap of nearley parser | ||
@@ -141,5 +141,5 @@ let begin: string | null = null; | ||
} | ||
e.message = msg; | ||
(e as any).message = msg; | ||
throw e; | ||
} | ||
} |
@@ -416,3 +416,43 @@ import 'mocha'; | ||
}] | ||
}) | ||
}); | ||
checkAlterTable(['ALTER TABLE foo DROP bar CASCADE'], { | ||
type: 'alter table', | ||
table: { name: 'foo' }, | ||
changes: [{ | ||
type: 'drop column', | ||
column: { name: 'bar' }, | ||
behaviour: 'cascade', | ||
}], | ||
}); | ||
checkAlterTable(['alter table test drop column a cascade, drop column b restrict'], { | ||
type: 'alter table', | ||
table: { name: 'test' }, | ||
changes: [{ | ||
type: 'drop column', | ||
column: { name: 'a' }, | ||
behaviour: 'cascade', | ||
}, { | ||
type: 'drop column', | ||
column: { name: 'b' }, | ||
behaviour: 'restrict', | ||
}], | ||
}); | ||
checkAlterTable(['alter table test drop constraint a cascade, drop constraint b restrict'], { | ||
type: 'alter table', | ||
table: { name: 'test' }, | ||
changes: [{ | ||
type: 'drop constraint', | ||
constraint: { name: 'a' }, | ||
behaviour: 'cascade', | ||
}, { | ||
type: 'drop constraint', | ||
constraint: { name: 'b' }, | ||
behaviour: 'restrict', | ||
}], | ||
}); | ||
}); |
@@ -31,2 +31,3 @@ // import { IType } from '../../interfaces'; | ||
| AlterTableStatement | ||
| AlterIndexStatement | ||
| AlterSequenceStatement | ||
@@ -197,3 +198,3 @@ | SetGlobalStatement | ||
export interface DropStatement extends PGNode { | ||
type: 'drop table' | 'drop sequence' | 'drop index' | 'drop type'; | ||
type: 'drop table' | 'drop sequence' | 'drop index' | 'drop type' | 'drop trigger'; | ||
names: QName[]; | ||
@@ -246,3 +247,3 @@ ifExists?: boolean; | ||
export interface OnConflictAction extends PGNode { | ||
on?: Expr[] | nil; | ||
on?: OnConflictOnExpr | OnConflictOnConstraint; | ||
do: 'do nothing' | { | ||
@@ -254,2 +255,33 @@ sets: SetStatement[]; | ||
export interface OnConflictOnExpr extends PGNode { | ||
type: 'on expr'; | ||
exprs: Expr[]; | ||
} | ||
export interface OnConflictOnConstraint extends PGNode { | ||
type: 'on constraint'; | ||
constraint: QName; | ||
} | ||
export interface AlterIndexStatement extends PGNode { | ||
type: 'alter index'; | ||
index: QNameAliased; | ||
ifExists?: boolean; | ||
change: IndexAlteration; | ||
} | ||
export type IndexAlteration | ||
= IndexAlterationRename | ||
| IndexAlterationSetTablespace | ||
export interface IndexAlterationRename { | ||
type: 'rename'; | ||
to: QName; | ||
} | ||
export interface IndexAlterationSetTablespace { | ||
type: 'set tablespace'; | ||
tablespace: QName; | ||
} | ||
export interface AlterTableStatement extends PGNode { | ||
@@ -288,2 +320,3 @@ type: 'alter table'; | ||
column: Name; | ||
behaviour?: 'cascade' | 'restrict'; | ||
} | ||
@@ -760,3 +793,3 @@ | ||
export type MathOpsBinary = '|' | '&' | '>>' | '^' | '#' | '<<' | '>>'; | ||
export type ComparisonOperator = '>' | '>=' | '<' | '<=' | '@>' | '<@' | '?' | '?|' | '?&' | '#>>' | '~'; | ||
export type ComparisonOperator = '>' | '>=' | '<' | '<=' | '@>' | '<@' | '?' | '?|' | '?&' | '#>>' | '~' | '~*' | '!~' | '!~*'; | ||
export type AdditiveOperator = '||' | '-' | '#-' | '&&' | '+'; | ||
@@ -763,0 +796,0 @@ export type MultiplicativeOperator = '*' | '%' | '/'; |
@@ -65,2 +65,7 @@ import 'mocha'; | ||
checkStatement([`DROP TRIGGER test`], { | ||
type: 'drop trigger', | ||
names: [{ name: 'test' }], | ||
}); | ||
checkStatement([`drop index concurrently if exists test`], { | ||
@@ -67,0 +72,0 @@ type: 'drop index', |
@@ -910,2 +910,23 @@ import 'mocha'; | ||
checkTreeExpr([`$1 ~* '.*'`], { | ||
type: 'binary', | ||
op: '~*', | ||
left: { type: 'parameter', name: '$1' }, | ||
right: { type: 'string', value: '.*' }, | ||
}); | ||
checkTreeExpr([`$1 !~ '.*'`], { | ||
type: 'binary', | ||
op: '!~', | ||
left: { type: 'parameter', name: '$1' }, | ||
right: { type: 'string', value: '.*' }, | ||
}); | ||
checkTreeExpr([`$1 !~* '.*'`], { | ||
type: 'binary', | ||
op: '!~*', | ||
left: { type: 'parameter', name: '$1' }, | ||
right: { type: 'string', value: '.*' }, | ||
}); | ||
checkTreeExpr(['a != b', '"a"!="b"', 'a<>b'], { | ||
@@ -912,0 +933,0 @@ type: 'binary', |
@@ -62,2 +62,22 @@ import 'mocha'; | ||
checkInsert([`insert into test(a) values (1) on conflict on constraint cst do nothing`], { | ||
type: 'insert', | ||
into: { name: 'test' }, | ||
columns: [{ name: 'a' }], | ||
insert: { | ||
type: 'values', | ||
values: [[{ | ||
type: 'integer', | ||
value: 1, | ||
},]] | ||
}, | ||
onConflict: { | ||
do: 'do nothing', | ||
on: { | ||
type: 'on constraint', | ||
constraint: { name: 'cst' }, | ||
} | ||
}, | ||
}); | ||
checkInsert([`insert into test(a) values (1) on conflict (a, b) do nothing`], { | ||
@@ -76,6 +96,9 @@ type: 'insert', | ||
do: 'do nothing', | ||
on: [ | ||
{ type: 'ref', name: 'a' } | ||
, { type: 'ref', name: 'b' } | ||
] | ||
on: { | ||
type: 'on expr', | ||
exprs: [ | ||
{ type: 'ref', name: 'a' } | ||
, { type: 'ref', name: 'b' } | ||
], | ||
}, | ||
}, | ||
@@ -82,0 +105,0 @@ }); |
@@ -5,3 +5,3 @@ import { Parser, Grammar } from 'nearley'; | ||
import { trimNullish } from '../utils'; | ||
import { Expr, SelectStatement, CreateTableStatement, CreateIndexStatement, Statement, InsertStatement, UpdateStatement, AlterTableStatement, DeleteStatement, CreateExtensionStatement, CreateSequenceStatement, AlterSequenceStatement, SelectedColumn, Interval, BinaryOperator, ExprBinary, Name, ExprInteger, FromTable, QName } from './ast'; | ||
import { Expr, SelectStatement, CreateTableStatement, CreateIndexStatement, Statement, InsertStatement, UpdateStatement, AlterTableStatement, DeleteStatement, CreateExtensionStatement, CreateSequenceStatement, AlterSequenceStatement, SelectedColumn, Interval, BinaryOperator, ExprBinary, Name, ExprInteger, FromTable, QName, AlterIndexStatement } from './ast'; | ||
import { astMapper, IAstMapper } from '../ast-mapper'; | ||
@@ -54,2 +54,5 @@ import { toSql, IAstToSql } from '../to-sql'; | ||
} | ||
export function checkAlterIndex(value: string | string[], expected: AlterIndexStatement) { | ||
checkTree(value, expected, (p, m) => m.statement(p)); | ||
} | ||
export function checkAlterTableLoc(value: string | string[], expected: AlterTableStatement) { | ||
@@ -56,0 +59,0 @@ checkTree(value, expected, (p, m) => m.statement(p), undefined, true); |
@@ -365,2 +365,24 @@ import { IAstPartialMapper, AstDefaultMapper } from './ast-mapper'; | ||
alterIndex: t => { | ||
ret.push('ALTER INDEX '); | ||
if (t.ifExists) { | ||
ret.push(' IF EXISTS '); | ||
} | ||
visitQualifiedNameAliased(t.index); | ||
switch (t.change.type) { | ||
case 'rename': | ||
ret.push(' RENAME TO '); | ||
visitQualifiedName(t.change.to); | ||
ret.push(' '); | ||
break; | ||
case 'set tablespace': | ||
ret.push(' SET TABLESPACE '); | ||
visitQualifiedName(t.change.tablespace); | ||
ret.push(' '); | ||
break; | ||
default: | ||
throw NotSupported.never(t.change, 'Alter index type not supported: '); | ||
} | ||
}, | ||
tableAlteration: (change, table) => { | ||
@@ -998,2 +1020,6 @@ switch (change.type) { | ||
ret.push(name(t.column)); | ||
if (t.behaviour) { | ||
ret.push(' ', t.behaviour); | ||
} | ||
ret.push(' '); | ||
}, | ||
@@ -1105,4 +1131,15 @@ | ||
ret.push('ON CONFLICT '); | ||
if (i.onConflict.on) { | ||
list(i.onConflict.on, e => m.expr(e), true); | ||
const on = i.onConflict.on; | ||
switch (on?.type) { | ||
case 'on expr': | ||
list(on.exprs, e => m.expr(e), true); | ||
break; | ||
case 'on constraint': | ||
ret.push('ON CONSTRAINT '); | ||
visitQualifiedName(on.constraint); | ||
case null: | ||
case undefined: | ||
break; | ||
default: | ||
throw NotSupported.never(on); | ||
} | ||
@@ -1109,0 +1146,0 @@ if (i.onConflict.do === 'do nothing') { |
import { nil } from '../utils'; | ||
export declare function locationOf(node: PGNode): NodeLocation; | ||
export declare type Statement = SelectStatement | CreateTableStatement | CreateSequenceStatement | CreateIndexStatement | CreateExtensionStatement | CommitStatement | InsertStatement | UpdateStatement | ShowStatement | PrepareStatement | DeallocateStatement | DeleteStatement | WithStatement | RollbackStatement | TablespaceStatement | CreateViewStatement | CreateMaterializedViewStatement | RefreshMaterializedViewStatement | AlterTableStatement | AlterSequenceStatement | SetGlobalStatement | SetTimezone | CreateEnumType | CreateCompositeType | TruncateTableStatement | DropStatement | CommentStatement | CreateSchemaStatement | WithRecursiveStatement | RaiseStatement | ValuesStatement | CreateFunctionStatement | DropFunctionStatement | DoStatement | BeginStatement | StartTransactionStatement; | ||
export declare type Statement = SelectStatement | CreateTableStatement | CreateSequenceStatement | CreateIndexStatement | CreateExtensionStatement | CommitStatement | InsertStatement | UpdateStatement | ShowStatement | PrepareStatement | DeallocateStatement | DeleteStatement | WithStatement | RollbackStatement | TablespaceStatement | CreateViewStatement | CreateMaterializedViewStatement | RefreshMaterializedViewStatement | AlterTableStatement | AlterIndexStatement | AlterSequenceStatement | SetGlobalStatement | SetTimezone | CreateEnumType | CreateCompositeType | TruncateTableStatement | DropStatement | CommentStatement | CreateSchemaStatement | WithRecursiveStatement | RaiseStatement | ValuesStatement | CreateFunctionStatement | DropFunctionStatement | DoStatement | BeginStatement | StartTransactionStatement; | ||
export interface PGNode { | ||
@@ -127,3 +127,3 @@ _location?: NodeLocation; | ||
export interface DropStatement extends PGNode { | ||
type: 'drop table' | 'drop sequence' | 'drop index' | 'drop type'; | ||
type: 'drop table' | 'drop sequence' | 'drop index' | 'drop type' | 'drop trigger'; | ||
names: QName[]; | ||
@@ -169,3 +169,3 @@ ifExists?: boolean; | ||
export interface OnConflictAction extends PGNode { | ||
on?: Expr[] | nil; | ||
on?: OnConflictOnExpr | OnConflictOnConstraint; | ||
do: 'do nothing' | { | ||
@@ -176,2 +176,25 @@ sets: SetStatement[]; | ||
} | ||
export interface OnConflictOnExpr extends PGNode { | ||
type: 'on expr'; | ||
exprs: Expr[]; | ||
} | ||
export interface OnConflictOnConstraint extends PGNode { | ||
type: 'on constraint'; | ||
constraint: QName; | ||
} | ||
export interface AlterIndexStatement extends PGNode { | ||
type: 'alter index'; | ||
index: QNameAliased; | ||
ifExists?: boolean; | ||
change: IndexAlteration; | ||
} | ||
export declare type IndexAlteration = IndexAlterationRename | IndexAlterationSetTablespace; | ||
export interface IndexAlterationRename { | ||
type: 'rename'; | ||
to: QName; | ||
} | ||
export interface IndexAlterationSetTablespace { | ||
type: 'set tablespace'; | ||
tablespace: QName; | ||
} | ||
export interface AlterTableStatement extends PGNode { | ||
@@ -207,2 +230,3 @@ type: 'alter table'; | ||
column: Name; | ||
behaviour?: 'cascade' | 'restrict'; | ||
} | ||
@@ -535,3 +559,3 @@ export interface TableAlterationDropConstraint extends PGNode { | ||
export declare type MathOpsBinary = '|' | '&' | '>>' | '^' | '#' | '<<' | '>>'; | ||
export declare type ComparisonOperator = '>' | '>=' | '<' | '<=' | '@>' | '<@' | '?' | '?|' | '?&' | '#>>' | '~'; | ||
export declare type ComparisonOperator = '>' | '>=' | '<' | '<=' | '@>' | '<@' | '?' | '?|' | '?&' | '#>>' | '~' | '~*' | '!~' | '!~*'; | ||
export declare type AdditiveOperator = '||' | '-' | '#-' | '&&' | '+'; | ||
@@ -538,0 +562,0 @@ export declare type MultiplicativeOperator = '*' | '%' | '/'; |
@@ -9,3 +9,3 @@ interface NearleyToken { | ||
save: () => any; | ||
formatError: (token: NearleyToken) => string; | ||
formatError: (token: never) => string; | ||
has: (tokenType: string) => boolean; | ||
@@ -12,0 +12,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Expr, SelectStatement, CreateTableStatement, CreateIndexStatement, Statement, InsertStatement, UpdateStatement, AlterTableStatement, DeleteStatement, CreateExtensionStatement, CreateSequenceStatement, AlterSequenceStatement, SelectedColumn, Interval, BinaryOperator, ExprBinary, Name, ExprInteger, FromTable, QName } from './ast'; | ||
import { Expr, SelectStatement, CreateTableStatement, CreateIndexStatement, Statement, InsertStatement, UpdateStatement, AlterTableStatement, DeleteStatement, CreateExtensionStatement, CreateSequenceStatement, AlterSequenceStatement, SelectedColumn, Interval, BinaryOperator, ExprBinary, Name, ExprInteger, FromTable, QName, AlterIndexStatement } from './ast'; | ||
export declare function checkSelect(value: string | string[], expected: SelectStatement): void; | ||
@@ -14,2 +14,3 @@ export declare function checkCreateSequence(value: string | string[], expected: CreateSequenceStatement): void; | ||
export declare function checkAlterTable(value: string | string[], expected: AlterTableStatement): void; | ||
export declare function checkAlterIndex(value: string | string[], expected: AlterIndexStatement): void; | ||
export declare function checkAlterTableLoc(value: string | string[], expected: AlterTableStatement): void; | ||
@@ -16,0 +17,0 @@ export declare function checkUpdate(value: string | string[], expected: UpdateStatement): void; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1665738
180
18125