-
Notifications
You must be signed in to change notification settings - Fork 2
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
introspect columns to include default, generated and identity columns #256
Conversation
#[serde(default)] | ||
pub description: Option<String>, | ||
} | ||
|
||
fn does_not_have_default(has_default: &HasDefault) -> bool { | ||
matches!(has_default, HasDefault::NoDefault) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a clippy suggestion :)
-- skipped because yugabyte is based on pg11 that does not have this field. | ||
-- CASE WHEN att.attgenerated = 's' THEN 'isGenerated' ELSE 'notGenerated' END | ||
-- AS is_generated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a trick being employed in pg_table_metadata.sql
of HGE v2 which deals with this very issue. It could well be worth it to port that over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good to know, for reference: https://github.com/hasura/graphql-engine/blob/master/server/src-rsr/pg_table_metadata.sql#L70-75
Will do that in a follow-up PR.
What
In order to generate insert mutations we'd like to know which columns should be inserted into, which we shouldn't insert to, and which can go either way.
To do that we add settings for default, generated, and identity information to column information, as well as introspection code.
How
ColumnInfo
metadatapg_attribute
, but see the comment about generated columns