Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
12 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,9 +273,9 @@ def client_min_messages=(level) | |
def default_sequence_name(table_name, pk = nil) #:nodoc: | ||
result = serial_sequence(table_name, pk || 'id') | ||
return nil unless result | ||
result.split('.').last | ||
Utils.extract_schema_qualified_name(result) | ||
rescue ActiveRecord::StatementInvalid | ||
"#{table_name}_#{pk || 'id'}_seq" | ||
PostgreSQL::Name.new(nil, "#{table_name}_#{pk || 'id'}_seq") | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
senny
Author
Member
|
||
end | ||
|
||
def serial_sequence(table, column) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@senny FYI, this changes the return value of #sequence_name, which is apparently public? (
#sequence_name=
is public, I guess it makes sense that the reader is public too.)I noticed this while testing discourse with 4.2. This change broke the
seed-fu
gem, although I believe it's nolonger an issue for that particular gem on the latest version, because it happens to use interpolation now which calls#to_s
on thePostgreSQL::Name
.Not sure if there's any action items here. Some thoughts:
to_s
on#sequence_name
and other public methods, where people might be expecting strings?to_str
onName
so it acts more like strings? (It would work for"'" + sequence_name + "'"
, but it will still break if you try to call String methods on it)#to_s
in method missing like AS::Duration?