Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ok?
  • Loading branch information
juleswritescode committed Sep 27, 2025
commit 7e630099665204cd0841bcd41dbba09aab120c20
11 changes: 3 additions & 8 deletions crates/pgt_typecheck/src/typed_identifier.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use itertools::Itertools;
use pgt_schema_cache::PostgresType;
use pgt_text_size::{TextRange, TextRangeReplacement, TextRangeReplacementBuilder};
use pgt_text_size::{TextRangeReplacement, TextRangeReplacementBuilder};
use pgt_treesitter::queries::{ParameterMatch, TreeSitterQueriesExecutor};

/// It is used to replace parameters within the SQL string.
Expand Down Expand Up @@ -63,11 +63,7 @@ pub fn apply_identifiers<'a>(
let range_size = range.end - range.start;

// if the default_value is shorter than "range", fill it up with spaces
let default_value = if default_value.len() < range_size {
format!("{:<range_size$}", default_value)
} else {
default_value
};
let default_value = format!("{:<range_size$}", default_value);

text_range_replacement_builder
.replace_range(range.clone().try_into().unwrap(), &default_value);
Expand Down Expand Up @@ -323,8 +319,7 @@ mod tests {
assert_eq!(
replacement.text(),
// the numeric parameters are filled with 0;
// all values of the enums are longer than `NULL`, so we use `NULL` instead
"select 0 + 0 + 0 + 0 + 0 + NULL "
"select 0 + 0 + 0 + 0 + 0 + 'critical'"
Comment on lines -335 to +317
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if the change from NULL to 'critical' is desired?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, makes sense after your change

);
}

Expand Down
Loading