Skip to content

Commit 8213c85

Browse files
committed
feat: add datatypes aliases
1 parent 255ffb3 commit 8213c85

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

crates/parser/src/parse/libpg_query_node.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,23 @@ impl<'p> LibpgQueryNodeParser<'p> {
412412
}
413413

414414
/// list of aliases from https://www.postgresql.org/docs/current/datatype.html
415-
const ALIASES: [&[&str]; 2] = [&["integer", "int", "int4"], &["real", "float4"]];
415+
const ALIASES: [&[&str]; 15] = [
416+
&["bigint", "int8"],
417+
&["bigserial", "serial8"],
418+
&["bit varying", "varbit"],
419+
&["boolean", "bool"],
420+
&["character", "char"],
421+
&["character varying", "varchar"],
422+
&["double precision", "float8"],
423+
&["integer", "int", "int4"],
424+
&["numeric", "decimal"],
425+
&["real", "float4"],
426+
&["smallint", "int2"],
427+
&["smallserial", "serial2"],
428+
&["serial", "serial4"],
429+
&["time with time zone", "timetz"],
430+
&["timestamp with time zone", "timestamptz"],
431+
];
416432

417433
fn cmp_tokens(p: &crate::codegen::TokenProperty, token: &crate::lexer::Token) -> bool {
418434
// TokenProperty has always either value or kind set

0 commit comments

Comments
 (0)