Skip to content

Commit 29a47de

Browse files
authored
Merge pull request #109 from cvng/feat/aliases
feat: add datatypes aliases
2 parents ab3c4ea + 5352e3e commit 29a47de

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

crates/parser/src/parse/libpg_query_node.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,19 @@ 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+
/// NOTE: support for multi-word alias (e.g. time with time zone) requires parser change
416+
const ALIASES: [&[&str]; 10] = [
417+
&["bigint", "int8"],
418+
&["bigserial", "serial8"],
419+
&["boolean", "bool"],
420+
&["character", "char"],
421+
&["integer", "int", "int4"],
422+
&["numeric", "decimal"],
423+
&["real", "float4"],
424+
&["smallint", "int2"],
425+
&["smallserial", "serial2"],
426+
&["serial", "serial4"],
427+
];
416428

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

0 commit comments

Comments
 (0)