-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix: handle column default types correctly in SchemaCache #3750
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -622,10 +622,11 @@ tablesSqlQuery = | |||||||||||||||||
d.description AS description, | ||||||||||||||||||
-- typbasetype and typdefaultbin handles `CREATE DOMAIN .. DEFAULT val`, attidentity/attgenerated handles generated columns, pg_get_expr gets the default of a column | ||||||||||||||||||
CASE | ||||||||||||||||||
WHEN t.typbasetype != 0 THEN pg_get_expr(t.typdefaultbin, 0) | ||||||||||||||||||
WHEN a.attidentity = 'd' THEN format('nextval(%L)', seq.objid::regclass) | ||||||||||||||||||
WHEN a.attgenerated = 's' THEN null | ||||||||||||||||||
ELSE pg_get_expr(ad.adbin, ad.adrelid)::text | ||||||||||||||||||
WHEN t.typbasetype != 0 THEN pg_get_expr(t.typdefaultbin, 0) | ||||||||||||||||||
WHEN a.attidentity = 'd' THEN format('nextval(%L)', seq.objid::regclass) | ||||||||||||||||||
WHEN a.attgenerated = 's' THEN null | ||||||||||||||||||
WHEN ad.adbin IS NOT NULL THEN pg_get_expr(ad.adbin, ad.adrelid)::text | ||||||||||||||||||
ELSE NULL -- Handle cases where none of the conditions are met | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still gives the same result since A test is needed to verify that changes work. Something similar to this one, but with another table with a column that overrides the domain default (like the one mentioned in the issue): postgrest/test/spec/Feature/Query/InsertSpec.hs Lines 566 to 573 in 5ca969f
|
||||||||||||||||||
END AS column_default, | ||||||||||||||||||
not (a.attnotnull OR t.typtype = 'd' AND t.typnotnull) AS is_nullable, | ||||||||||||||||||
CASE | ||||||||||||||||||
|
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 already an "Unreleased" section at the beginning of the document. The entry should go under the "Fixed" subtitle. Check the other entries for the format.