Skip to content

feat: add datatypes aliases #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion crates/parser/src/parse/libpg_query_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,23 @@ impl<'p> LibpgQueryNodeParser<'p> {
}

/// list of aliases from https://www.postgresql.org/docs/current/datatype.html
const ALIASES: [&[&str]; 2] = [&["integer", "int", "int4"], &["real", "float4"]];
const ALIASES: [&[&str]; 15] = [
&["bigint", "int8"],
&["bigserial", "serial8"],
&["bit varying", "varbit"],
&["boolean", "bool"],
&["character", "char"],
&["character varying", "varchar"],
&["double precision", "float8"],
&["integer", "int", "int4"],
&["numeric", "decimal"],
&["real", "float4"],
&["smallint", "int2"],
&["smallserial", "serial2"],
&["serial", "serial4"],
&["time with time zone", "timetz"],
&["timestamp with time zone", "timestamptz"],
];

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