pgsql-ast-parser
Advanced tools
Comparing version 9.0.0 to 9.0.1
{ | ||
"name": "pgsql-ast-parser", | ||
"version": "9.0.0", | ||
"version": "9.0.1", | ||
"description": "Yet another simple Postgres SQL parser/modifier", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -700,2 +700,15 @@ import 'mocha'; | ||
}); | ||
checkTreeExpr(`('now'::text)::timestamp(4) with time zone`, { | ||
type: 'cast', | ||
to: { | ||
name: 'timestamp with time zone', | ||
config: [4], | ||
}, | ||
operand: { | ||
type: 'cast', | ||
to: { name: 'text' }, | ||
operand: { type: 'string', value: 'now' }, | ||
}, | ||
}); | ||
}); | ||
@@ -702,0 +715,0 @@ |
@@ -58,2 +58,5 @@ import 'mocha'; | ||
.to.equal(`(('2021-04-03 16:16:02')::timestamp with time zone )`); | ||
expect(expr(`('now'::text)::timestamp(4) with time zone`)) | ||
.to.equal(`((('now')::text )::timestamp(4) with time zone )`); | ||
}); | ||
@@ -60,0 +63,0 @@ |
@@ -788,2 +788,3 @@ import { IAstPartialMapper, AstDefaultMapper } from './ast-mapper'; | ||
} | ||
let appendConfig = true; | ||
if (d.schema) { | ||
@@ -798,2 +799,4 @@ visitQualifiedName(d); | ||
case 'bit varying': | ||
ret.push(d.name, ' '); | ||
break; | ||
case 'time without time zone': | ||
@@ -803,3 +806,12 @@ case 'timestamp without time zone': | ||
case 'timestamp with time zone': | ||
ret.push(d.name, ' '); | ||
const parts = d.name.split(' '); | ||
ret.push(parts.shift()!); | ||
if (d.config?.length) { | ||
list(d.config, v => ret.push(v.toString(10)), true); | ||
} | ||
ret.push(' '); | ||
ret.push(parts.join(' '), ' '); | ||
appendConfig = false; | ||
break; | ||
@@ -812,3 +824,3 @@ default: | ||
if (d.config?.length) { | ||
if (appendConfig && d.config?.length) { | ||
list(d.config, v => ret.push(v.toString(10)), true); | ||
@@ -815,0 +827,0 @@ } |
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
1462815
16168