Skip to content

Commit e151c68

Browse files
fix: nullabe column query
1 parent 62ce45d commit e151c68

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

crates/pgt_completions/src/providers/columns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn complete_columns<'a>(ctx: &CompletionContext<'a>, builder: &mut Completio
2020
description: format!("Table: {}.{}", col.schema_name, col.table_name),
2121
kind: CompletionItemKind::Column,
2222
completion_text: None,
23-
detail: Some(col.type_name.to_string()),
23+
detail: col.type_name.as_ref().map(|t| t.to_string()),
2424
};
2525

2626
// autocomplete with the alias in a join clause if we find one

crates/pgt_schema_cache/src/columns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct Column {
4848

4949
pub schema_name: String,
5050
pub type_id: i64,
51-
pub type_name: String,
51+
pub type_name: Option<String>,
5252
pub is_nullable: bool,
5353

5454
pub is_primary_key: bool,

crates/pgt_schema_cache/src/queries/columns.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ from
5555
left join pg_catalog.pg_type tps on tps.oid = atts.atttypid
5656
where
5757
-- system columns, such as `cmax` or `tableoid`, have negative `attnum`s
58-
atts.attnum >= 0
58+
atts.attnum >= 0 and atts.atttypid != null
5959
order by
6060
schema_name desc,
6161
table_name,

0 commit comments

Comments
 (0)