-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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 for #10613 . This PR is still WIP. #12519
Changes from all 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 |
---|---|---|
|
@@ -169,12 +169,15 @@ def indexes(table_name, name = nil) | |
end | ||
|
||
# Returns the list of all column definitions for a table. | ||
def columns(table_name) | ||
def columns(table_name, typecast = true) | ||
# Limit, precision, and scale are all handled by the superclass. | ||
column_definitions(table_name).map do |column_name, type, default, notnull, oid, fmod| | ||
oid = OID::TYPE_MAP.fetch(oid.to_i, fmod.to_i) { | ||
OID::Identity.new | ||
} | ||
if !typecast && ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Array === oid && ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Identity === oid.subtype | ||
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. Instead of type checking we should define an API with a default implementation and implement it in a different way on Array 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. @rafaelfranca will look into it this week. |
||
oid.typecast = false | ||
end | ||
PostgreSQLColumn.new(column_name, default, oid, type, notnull == 'f') | ||
end | ||
end | ||
|
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.
Why do we need this guard?
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.
@rafaelfranca I'm not able to recall why I added that. :-(
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.
😢