Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Commit

Permalink
using Javascript's MAX_SAFE_INTEGER for infinity
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfliegner committed Oct 7, 2022
1 parent fbe930b commit 5ee45d3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
53 changes: 32 additions & 21 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.8.0"
manifest_format = "2.0"
project_hash = "d56a0945c1d06c596fb0061f73af998900e257da"
project_hash = "ef1b87c6fb223c8779d30072c509905d8ea3d043"

[[deps.AbstractTrees]]
git-tree-sha1 = "5c0b629df8a5566a06f5fef5100b53ea56e465a0"
Expand Down Expand Up @@ -32,9 +32,9 @@ version = "0.4.2"

[[deps.Compat]]
deps = ["Dates", "LinearAlgebra", "UUIDs"]
git-tree-sha1 = "5856d3031cdb1f3b2b6340dfdc66b6d9a149a374"
git-tree-sha1 = "3ca828fe1b75fa84b021a7860bd039eaea84d2f2"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "4.2.0"
version = "4.3.0"

[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
Expand All @@ -47,15 +47,15 @@ uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
version = "4.1.1"

[[deps.DataAPI]]
git-tree-sha1 = "1106fa7e1256b402a86a8e7b15c00c85036fef49"
git-tree-sha1 = "46d2680e618f8abd007bce0c3026cb0c4a8f2032"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.11.0"
version = "1.12.0"

[[deps.DataFrames]]
deps = ["Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"]
git-tree-sha1 = "db2a9cb664fcea7836da4b414c3278d71dd602d2"
deps = ["Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Random", "Reexport", "SnoopPrecompile", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"]
git-tree-sha1 = "558078b0b78278683a7445c626ee78c86b9bb000"
uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
version = "1.3.6"
version = "1.4.1"

[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
Expand Down Expand Up @@ -83,9 +83,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[deps.DocStringExtensions]]
deps = ["LibGit2"]
git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b"
git-tree-sha1 = "5158c2b41018c5f7eb1470d558127ac274eca0c9"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.6"
version = "0.9.1"

[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
Expand Down Expand Up @@ -124,9 +124,9 @@ version = "1.0.1"

[[deps.InlineStrings]]
deps = ["Parsers"]
git-tree-sha1 = "d19f9edd8c34760dca2de2b503f969d8700ed288"
git-tree-sha1 = "d0ca109edbae6b4cc00e751a29dcb15a124053d6"
uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48"
version = "1.1.4"
version = "1.2.0"

[[deps.InteractiveUtils]]
deps = ["Markdown"]
Expand Down Expand Up @@ -196,9 +196,9 @@ uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"

[[deps.LibPQ]]
deps = ["CEnum", "Dates", "Decimals", "DocStringExtensions", "FileWatching", "Infinity", "Intervals", "IterTools", "LayerDicts", "LibPQ_jll", "Libdl", "Memento", "OffsetArrays", "SQLStrings", "Tables", "TimeZones"]
git-tree-sha1 = "c66b79cc389877e69cdc465f9a29ea47ebe8dca9"
git-tree-sha1 = "98f4d4dcfd5fca71b8acf0a90772badfdbac5660"
uuid = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1"
version = "1.14.0"
version = "1.14.1"

[[deps.LibPQ_jll]]
deps = ["Artifacts", "JLLWrappers", "Kerberos_krb5_jll", "Libdl", "OpenSSL_jll", "Pkg"]
Expand Down Expand Up @@ -316,10 +316,10 @@ uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.3.0"

[[deps.PrettyTables]]
deps = ["Crayons", "Formatting", "Markdown", "Reexport", "Tables"]
git-tree-sha1 = "dfb54c4e414caa595a1f2ed759b160f5a3ddcba5"
deps = ["Crayons", "Formatting", "Markdown", "Reexport", "StringManipulation", "Tables"]
git-tree-sha1 = "460d9e154365e058c4d886f6f7d6df5ffa1ea80e"
uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
version = "1.3.1"
version = "2.1.2"

[[deps.Printf]]
deps = ["Unicode"]
Expand All @@ -334,9 +334,10 @@ deps = ["SHA", "Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[deps.RecipesBase]]
git-tree-sha1 = "6bf3f380ff52ce0832ddd3a2a7b9538ed1bcca7d"
deps = ["SnoopPrecompile"]
git-tree-sha1 = "612a4d76ad98e9722c8ba387614539155a59e30c"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "1.2.1"
version = "1.3.0"

[[deps.Reexport]]
git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
Expand Down Expand Up @@ -366,9 +367,9 @@ version = "1.1.1"

[[deps.SearchLight]]
deps = ["DataFrames", "Dates", "Distributed", "Inflector", "Intervals", "JSON3", "Logging", "Millboard", "OrderedCollections", "Reexport", "SHA", "Unicode", "YAML"]
git-tree-sha1 = "86ed053297e072920e853e1569121458badc0e65"
git-tree-sha1 = "2e6b6633778fdf866c773e817d915e45b3a118f6"
uuid = "340e8cb6-72eb-11e8-37ce-c97ebeb32050"
version = "2.7.1"
version = "2.8.0"

[[deps.SearchLightPostgreSQL]]
deps = ["DataFrames", "LibPQ", "Logging", "SearchLight"]
Expand All @@ -379,6 +380,11 @@ version = "2.3.2"
[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[deps.SnoopPrecompile]]
git-tree-sha1 = "f604441450a3c0569830946e5b33b78c928e1a85"
uuid = "66db9d55-30c0-4569-8b51-7e840670fc0c"
version = "1.0.1"

[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

Expand All @@ -402,6 +408,11 @@ git-tree-sha1 = "50ccd5ddb00d19392577902f0079267a72c5ab04"
uuid = "69024149-9ee7-55f6-a4c4-859efe599b68"
version = "0.3.5"

[[deps.StringManipulation]]
git-tree-sha1 = "46da2434b41f41ac3594ee9816ce5541c6096123"
uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e"
version = "0.3.0"

[[deps.StructTypes]]
deps = ["Dates", "UUIDs"]
git-tree-sha1 = "ca4bccb03acf9faaf4137a9abc1881ed1841aa70"
Expand Down
4 changes: 4 additions & 0 deletions src/BitemporalPostgres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ end
# One ms less than the maximum date, as
const MaxDate = ZonedDateTime(DateTime(2038, 1, 19, 3, 14, 6, 999), tz"UTC")
const MaxDateSQL = SQLInput(MaxDate)
"""
InfinityKey
in order to ease integration with javascript we use javascript's MAX_SAFE_INTEGER 2^53 - 1
"""
const InfinityKey = 2^53 - 1
const MaxVersion = DbId(InfinityKey)
"""
Expand Down
6 changes: 3 additions & 3 deletions src/DDL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function up()
column(:id, :bigserial, "PRIMARY KEY")
column(:ref_component, :bigint, "REFERENCES testdummyComponents(id)")
column(:ref_validfrom, :bigint, "REFERENCES versions(id) ON DELETE CASCADE")
column(:ref_invalidfrom, :bigint, "DEFAULT 9223372036854775807 REFERENCES versions(id) ON DELETE SET DEFAULT")
column(:ref_invalidfrom, :bigint, "DEFAULT 2^53 - 1 REFERENCES versions(id) ON DELETE SET DEFAULT")
column(:ref_valid, :int8range)
column(:description, :string)
]
Expand All @@ -152,7 +152,7 @@ function up()
column(:id, :bigserial, "PRIMARY KEY")
column(:ref_component, :bigint, "REFERENCES testdummySubComponents(id)")
column(:ref_validfrom, :bigint, "REFERENCES versions(id) ON DELETE CASCADE")
column(:ref_invalidfrom, :bigint, "DEFAULT 9223372036854775807 REFERENCES versions(id) ON DELETE SET DEFAULT")
column(:ref_invalidfrom, :bigint, "DEFAULT 2^53 - 1 REFERENCES versions(id) ON DELETE SET DEFAULT")
column(:ref_valid, :int8range)
column(:description, :string)
]
Expand Down Expand Up @@ -192,7 +192,7 @@ function up()
SearchLight.query(createTestdummySubComponentRevisionsConstraints)
MaxDate = ZonedDateTime(DateTime(2038, 1, 19, 14, 7), tz"UTC")
MaxDateSQL = SQLInput(MaxDate)
InfinityKey = 9223372036854775807::Integer
InfinityKey = 2^53 - 1::Integer

SearchLight.query("""
INSERT INTO histories VALUES($InfinityKey,0)
Expand Down

2 comments on commit 5ee45d3

@michaelfliegner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:
using Javascript's MAX_SAFE_INTEGER for infinity

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/69721

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.5.0 -m "<description of version>" 5ee45d31310adedb6ebc1c8087ca6667088bc35b
git push origin v1.5.0

Please sign in to comment.