-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Give the following classes:
class A < ::Sequel::Model
plugin :bitemporal, version_class: AVersion
end
class AVersion < ::Sequel::Model
many_to_one :b, class: "B"
end
class B < ::Sequel::Model
plugin :bitemporal, version_class: BVersion
end
class BVersion < ::Sequel::Model
endWhen I do the following query I got PG::AmbiguousColumn: ERROR: column reference "created_at" is ambiguous.
A.current_versions_dataset.eager_graph(
b: :current_version
).select(
Sequel.qualify(:a_versions, :master_id)
)The cause of the issue is in the following code snippet, It does not specify which table the columns belong to.
def self.current_versions_dataset
t = ::Sequel::Plugins::Bitemporal.point_in_time
n = ::Sequel::Plugins::Bitemporal.now
version_class.where do
(created_at <= t) &
(Sequel.|({expired_at=>nil}, expired_at > t)) &
(valid_from <= n) &
(valid_to > n)
end
endMetadata
Metadata
Assignees
Labels
No labels