Skip to content

fix: nullabe column query #406

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 3 commits into from
May 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/pgt_completions/src/providers/columns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn complete_columns<'a>(ctx: &CompletionContext<'a>, builder: &mut Completio
description: format!("Table: {}.{}", col.schema_name, col.table_name),
kind: CompletionItemKind::Column,
completion_text: None,
detail: Some(col.type_name.to_string()),
detail: col.type_name.as_ref().map(|t| t.to_string()),
};

// autocomplete with the alias in a join clause if we find one
Expand Down
2 changes: 1 addition & 1 deletion crates/pgt_schema_cache/src/columns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct Column {

pub schema_name: String,
pub type_id: i64,
pub type_name: String,
pub type_name: Option<String>,
pub is_nullable: bool,

pub is_primary_key: bool,
Expand Down
4 changes: 2 additions & 2 deletions crates/pgt_schema_cache/src/queries/columns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ from
and atts.attnum = ix.attnum
left join pg_catalog.pg_attrdef def on atts.attrelid = def.adrelid
and atts.attnum = def.adnum
left join pg_catalog.pg_type tps on tps.oid = atts.atttypid
left join pg_catalog.pg_type tps on atts.atttypid = tps.oid
where
-- system columns, such as `cmax` or `tableoid`, have negative `attnum`s
atts.attnum >= 0
atts.attnum >= 0 and atts.atttypid is not null and tps.oid is not null
order by
schema_name desc,
table_name,
Expand Down