-
Notifications
You must be signed in to change notification settings - Fork 0
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
Bump sequel from 5.77.0 to 5.80.0 #625
Closed
Closed
Conversation
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
gem compare bigdecimal 3.1.6 3.1.7 Compared versions: ["3.1.6", "3.1.7"]
DIFFERENT date:
3.1.6: 2024-01-18 00:00:00 UTC
3.1.7: 2024-03-14 00:00:00 UTC
DIFFERENT require_paths:
3.1.6: ["/opt/hostedtoolcache/Ruby/3.2.4/x64/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-3.1.6", "lib"]
3.1.7: ["/opt/hostedtoolcache/Ruby/3.2.4/x64/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-3.1.7", "lib"]
DIFFERENT version:
3.1.6: 3.1.6
3.1.7: 3.1.7
DIFFERENT files:
3.1.6->3.1.7:
* Changed:
ext/bigdecimal/bigdecimal.c +1/-1 |
gem compare --diff bigdecimal 3.1.6 3.1.7 Compared versions: ["3.1.6", "3.1.7"]
DIFFERENT files:
3.1.6->3.1.7:
* Changed:
ext/bigdecimal/bigdecimal.c
--- /tmp/d20240502-1888-hbman9/bigdecimal-3.1.6/ext/bigdecimal/bigdecimal.c 2024-05-02 02:41:02.602358469 +0000
+++ /tmp/d20240502-1888-hbman9/bigdecimal-3.1.7/ext/bigdecimal/bigdecimal.c 2024-05-02 02:41:02.610358521 +0000
@@ -34 +34 @@
-#define BIGDECIMAL_VERSION "3.1.6"
+#define BIGDECIMAL_VERSION "3.1.7" |
gem compare sequel 5.77.0 5.80.0 Compared versions: ["5.77.0", "5.80.0"]
DIFFERENT date:
5.77.0: 2024-02-01 00:00:00 UTC
5.80.0: 2024-05-01 00:00:00 UTC
DIFFERENT rubygems_version:
5.77.0: 3.5.3
5.80.0: 3.5.9
DIFFERENT version:
5.77.0: 5.77.0
5.80.0: 5.80.0
DIFFERENT files:
5.77.0->5.80.0:
* Added:
doc/release_notes/5.78.0.txt +67/-0
doc/release_notes/5.79.0.txt +28/-0
doc/release_notes/5.80.0.txt +40/-0
lib/sequel/extensions/provenance.rb +108/-0
* Changed:
CHANGELOG +27/-1
README.rdoc +5/-3
doc/dataset_basics.rdoc +1/-1
doc/opening_databases.rdoc +2/-0
doc/querying.rdoc +6/-1
doc/schema_modification.rdoc +2/-2
lib/sequel/adapters/shared/mssql.rb +29/-1
lib/sequel/adapters/shared/mysql.rb +37/-2
lib/sequel/adapters/shared/postgres.rb +37/-2
lib/sequel/database/misc.rb +1/-0
lib/sequel/database/schema_methods.rb +2/-2
lib/sequel/dataset/dataset_module.rb +1/-1
lib/sequel/dataset/graph.rb +1/-0
lib/sequel/dataset/query.rb +58/-9
lib/sequel/exceptions.rb +5/-0
lib/sequel/extensions/async_thread_pool.rb +7/-0
lib/sequel/extensions/caller_logging.rb +2/-1
lib/sequel/extensions/migration.rb +12/-1
lib/sequel/extensions/sqlite_json_ops.rb +76/-18
lib/sequel/model/base.rb +1/-1
lib/sequel/version.rb +1/-1
DIFFERENT extra_rdoc_files:
5.77.0->5.80.0:
* Added:
doc/release_notes/5.78.0.txt +67/-0
doc/release_notes/5.79.0.txt +28/-0
doc/release_notes/5.80.0.txt +40/-0
* Changed:
README.rdoc +5/-3
CHANGELOG +27/-1
doc/dataset_basics.rdoc +1/-1
doc/opening_databases.rdoc +2/-0
doc/querying.rdoc +6/-1
doc/schema_modification.rdoc +2/-2 |
gem compare --diff sequel 5.77.0 5.80.0 Compared versions: ["5.77.0", "5.80.0"]
DIFFERENT files:
5.77.0->5.80.0:
* Added:
doc/release_notes/5.78.0.txt
--- /tmp/20240502-2464-xkl7rg 2024-05-02 02:41:09.914395052 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/doc/release_notes/5.78.0.txt 2024-05-02 02:41:09.790394354 +0000
@@ -0,0 +1,67 @@
+= New Features
+
+* SQLite 3.45+ jsonb functions are now supported in the sqlite_json_ops
+ extension. Similar to the postgres_json_ops extension, there are
+ now separate methods for dealing with json and jsonb types:
+
+ Sequel.sqlite_json_op(:column) # json
+ Sequel.sqlite_jsonb_op(:column) # jsonb
+
+ Some methods that use json_* functions for json ops use jsonb_*
+ functions for jsonb ops:
+
+ jb = Sequel.sqlite_jsonb_op(:column)
+ jb.extract('$.a') # jsonb_extract(column, '$.a')
+ jb.insert('$.a', 1) # jsonb_insert(column, '$.a', 1)
+ jb.set('$.a', 1) # jsonb_set(column, '$.a', 1)
+ jb.replace('$.a', 1) # jsonb_replace(column, '$.a', 1)
+ jb.remove('$.a') # jsonb_remove(column, '$.a')
+ jb.patch('{"a":2}') # jsonb_patch(column, '{"a":2}')
+
+ You can use the json and jsonb methods to convert jsonb to json
+ and json to jsonb, respectively.
+
+ jb.json # json(column)
+
+ Use of the json method on jsonb types is important, because if you
+ want to be able to deal with the values in Ruby, you must convert
+ the jsonb value to json in the database before the database returns
+ the value. Unlike PostgreSQL, SQLite will not convert the value
+ from jsonb to json on retrieval, and direct use of SQLite's jsonb
+ format is unsupported by SQLite as it is subject to change.
+
+* Database#with_advisory_lock is now supported on PostgreSQL, MySQL,
+ and Microsoft SQL Server. This supports advisory (explicit)
+ locking, using the database-specific APIs. To work on all three
+ servers, lock ids should be integers in the signed 64-bit range.
+
+ DB.with_advisory_lock(1234) do
+ # do something
+ end
+
+ By default, an AdvisoryLockError is raised if the lock cannot be
+ immediately acquired. You can use the :wait option to wait until
+ the lock can be acquired, instead of raising.
+
+ DB.with_advisory_lock(1234, wait: true) do
+ # do something
+ end
+
+* Migrator.run now supports a :use_advisory_lock option to use
+ advisory locks when running migrations, so that it does not
+ attempt to run the same migration more than once in the case
+ where multiple processes are running the migrator simultaneously.
+ It's probably best to avoid running the migrator in multiple
+ processes simultaneously instead of relying on this option.
+
+= Other Improvements
+
+* Database#values now supports chaining with compounds on
+ PostgreSQL.
+
+ DB.values([[1, 2]]).union(DB.values([[3, 4]]))
+ # SELECT * FROM (VALUES (1, 2) UNION (VALUES (3, 4))) AS t1
+
+* The internal hash used to store transaction metadata now uses
+ compare_by_identity, which is faster and avoids potential
+ issues if a driver implements connection object equality.
doc/release_notes/5.79.0.txt
--- /tmp/20240502-2464-sxfv48 2024-05-02 02:41:09.918395074 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/doc/release_notes/5.79.0.txt 2024-05-02 02:41:09.790394354 +0000
@@ -0,0 +1,28 @@
+= New Features
+
+* Dataset#select_prepend has been added for prepending to the
+ currently selected columns:
+
+ DB[:table].select_prepend(:column)
+ # SELECT column, table.*
+
+ As not all databases support "SELECT column, *", select_prepend
+ qualifies wildcard selections to all tables referenced in the
+ query.
+
+ The only reason to use select_prepend is if you want the hashes
+ returned by Sequel to be in a specific order. Otherwise, it is
+ better to use select_append.
+
+* On PostgreSQL, Sequel now supports an :unlogged_tables_default
+ Database option, which will default created tables to be UNLOGGED.
+ This can be useful to speedup testing in some cases, but it should
+ never be used in cases where data integrity is important.
+
+= Other Improvements
+
+* On PostgreSQL, Database#create_or_replace_view now supports the
+ :materialized option. This allows for dropping an existing
+ materialized view and creating a new one with the same name
+ (PostgreSQL does not have native support for replacing materialized
+ views).
doc/release_notes/5.80.0.txt
--- /tmp/20240502-2464-k7xpkm 2024-05-02 02:41:09.918395074 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/doc/release_notes/5.80.0.txt 2024-05-02 02:41:09.794394376 +0000
@@ -0,0 +1,40 @@
+= New Features
+
+* A provenance dataset extension has been added. This extension makes
+ SQL queries include a comment describing how the dataset was built.
+ This can make debugging complex cases significantly easier. Here's
+ a simple example:
+
+ DB.extension :provenance
+
+ DB[:table].
+ select(:a).
+ where{b > 10}.
+ order(:c).
+ limit(10)
+ # SQL:
+ # SELECT a FROM table WHERE (b > 10) ORDER BY c LIMIT 10 --
+ # -- Dataset Provenance
+ # -- Keys:[:from] Source:(eval at bin/sequel:257):2:in `<main>'
+ # -- Keys:[:select] Source:(eval at bin/sequel:257):3:in `<main>'
+ # -- Keys:[:where] Source:(eval at bin/sequel:257):4:in `<main>'
+ # -- Keys:[:order] Source:(eval at bin/sequel:257):5:in `<main>'
+ # -- Keys:[:limit] Source:(eval at bin/sequel:257):6:in `<main>'
+
+ With the above example, it's obvious how the dataset is created, but
+ but in real applications, where datasets can be built from multiple
+ files, seeing where each dataset clone was made can be helpful.
+
+ The source listed will skip locations in the Ruby standard library
+ as well as Sequel itself. Other locations can be skipped by
+ providing a Database :provenance_caller_ignore Regexp option:
+
+ DB.opts[:provenance_caller_ignore] = /\/gems\/library_name-/
+
+= Other Improvements
+
+* For dataset methods where Sequel can determine that the return
+ value would be equivalent to the receiver, Sequel now returns the
+ receiver. This reduces the number of dataset allocations.
+
+* Sequel now supports Dataset#skip_locked on MariaDB 10.6+.
lib/sequel/extensions/provenance.rb
--- /tmp/20240502-2464-yhx515 2024-05-02 02:41:09.918395074 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/extensions/provenance.rb 2024-05-02 02:41:09.890394917 +0000
@@ -0,0 +1,108 @@
+# frozen-string-literal: true
+#
+# The provenance dataset extension tracks the locations of all
+# dataset clones that resulted in the current dataset, and includes
+# the information as a comment in the dataset's SQL. This makes it
+# possible to see how a query was built, which can aid debugging.
+# Example:
+#
+# DB[:table].
+# select(:a).
+# where{b > 10}.
+# order(:c).
+# limit(10)
+# # SQL:
+# # SELECT a FROM table WHERE (b > 10) ORDER BY c LIMIT 10 --
+# # -- Dataset Provenance
+# # -- Keys:[:from] Source:(eval at bin/sequel:257):2:in `<main>'
+# # -- Keys:[:select] Source:(eval at bin/sequel:257):3:in `<main>'
+# # -- Keys:[:where] Source:(eval at bin/sequel:257):4:in `<main>'
+# # -- Keys:[:order] Source:(eval at bin/sequel:257):5:in `<main>'
+# # -- Keys:[:limit] Source:(eval at bin/sequel:257):6:in `<main>'
+#
+# With the above example, the source is fairly obvious and not helpful,
+# but in real applications, where datasets can be built from multiple
+# files, seeing where each dataset clone was made can be helpful.
+#
+# The Source listed will skip locations in the Ruby standard library
+# as well as Sequel itself. Other locations can be skipped by
+# providing a Database :provenance_caller_ignore Regexp option:
+#
+# DB.opts[:provenance_caller_ignore] = /\/gems\/library_name-/
+#
+# Related module: Sequel::Dataset::Provenance
+
+#
+module Sequel
+ class Dataset
+ module Provenance
+ SEQUEL_LIB_PATH = (File.expand_path('../../..', __FILE__) + '/').freeze
+ RUBY_STDLIB = RbConfig::CONFIG["rubylibdir"]
+
+ if TRUE_FREEZE
+ # Include provenance information when cloning datasets.
+ def clone(opts = nil || (return self))
+ super(provenance_opts(opts))
+ end
+ else
+ # :nocov:
+ def clone(opts = OPTS) # :nodoc:
+ super(provenance_opts(opts))
+ end
+ # :nocov:
+ end
+
+ %w'select insert update delete'.each do |type|
+ # Include the provenance information as a comment when preparing dataset SQL
+ define_method(:"#{type}_sql") do |*a|
+ sql = super(*a)
+
+ if provenance = @opts[:provenance]
+ comment = provenance.map do |hash|
+ " -- Keys:#{hash[:keys].inspect} Source:#{hash[:source]}".to_s.gsub(/\s+/, ' ')
+ end
+ comment << ""
+ comment.unshift " -- Dataset Provenance"
+ comment.unshift " -- "
+ comment = comment.join("\n")
+
+ if sql.frozen?
+ sql += comment
+ sql.freeze
+ elsif @opts[:append_sql] || @opts[:placeholder_literalizer]
+ sql << comment
+ else
+ sql += comment
+ end
+ end
+
+ sql
+ end
+ end
+
+ private
+
+ # Return a copy of opts with provenance information added.
+ def provenance_opts(opts)
+ provenance = {source: provenance_source, keys: opts.keys.freeze}.freeze
+ opts = opts.dup
+ opts[:provenance] = ((@opts[:provenance] || EMPTY_ARRAY).dup << provenance).freeze
+ opts
+ end
+
+ # Return the caller line for the provenance change. This skips
+ # Sequel itself and the standard library. Additional locations
+ # can be skipped using the :provenance_caller_ignore Dataset option.
+ def provenance_source
+ ignore = db.opts[:provenance_caller_ignore]
+ caller.find do |line|
+ !(line.start_with?(SEQUEL_LIB_PATH) ||
+ line.start_with?(RUBY_STDLIB) ||
+ (ignore && line =~ ignore))
+ end
+ end
+ end
+
+ register_extension(:provenance, Provenance)
+ end
+end
* Changed:
CHANGELOG
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/CHANGELOG 2024-05-02 02:41:09.626393431 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/CHANGELOG 2024-05-02 02:41:09.746394106 +0000
@@ -0,0 +1,26 @@
+=== 5.80.0 (2024-05-01)
+
+* Support Dataset#skip_locked on MariaDB 10.6+ (simi) (#2150)
+
+* Avoid allocating datasets in cases where the returned dataset would be the same as the receiver (jeremyevans)
+
+* Add provenance dataset extension, which includes comments in queries showing how and where the dataset was built (jeremyevans)
+
+=== 5.79.0 (2024-04-01)
+
+* Support create_or_replace_view with :materialized option on PostgreSQL (nashby) (#2144)
+
+* Support :unlogged_tables_default Database option on Postgres for making created tables unlogged by default (jeremyevans) (#2134)
+
+* Add Dataset#select_prepend for prepending to the current selected columns (jeremyevans) (#2139)
+
+=== 5.78.0 (2024-03-01)
+
+* Support SQLite 3.45+ jsonb functions in the sqlite_json_ops extension (jeremyevans) (#2133)
+
+* Support compounds (e.g. UNION) in conjunction with Database#values on PostgreSQL (jeremyevans) (#2137)
+
+* Support :use_advisory_lock option to Migrator.run to use advisory locks when running migrations (jeremyevans) (#2089)
+
+* Support Database#with_advisory_lock on PostgreSQL, MySQL, and Microsoft SQL Server (jeremyevans) (#2089)
+
@@ -19 +45 @@
-* Add transaction_connection_validator extension for retrying transactions on new connection if ther is a disconnect error when starting transaction (jeremyevans)
+* Add transaction_connection_validator extension for retrying transactions on new connection if there is a disconnect error when starting transaction (jeremyevans)
README.rdoc
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/README.rdoc 2024-05-02 02:41:09.626393431 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/README.rdoc 2024-05-02 02:41:09.746394106 +0000
@@ -25 +25 @@
-Alternate Discussion Forum (sequel-talk Google Group) :: http://groups.google.com/group/sequel-talk
+Archived Discussion Forum (sequel-talk Google Group) :: https://www.mail-archive.com/sequel-talk@googlegroups.com/
@@ -28 +28 @@
-GitHub Discussions or the sequel-talk Google Group.
+GitHub Discussions.
@@ -371 +371 @@
-As you might expect, there is an +order_append+ equivalent for +select+ called +select_append+:
+As you might expect, there are +order_append+ and +order_prepend+ equivalents for +select+ called +select_append+ and +select_prepend+:
@@ -374,0 +375,2 @@
+ posts.select(:stamp).select_prepend(:name)
+ # SELECT name, stamp FROM posts
doc/dataset_basics.rdoc
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/doc/dataset_basics.rdoc 2024-05-02 02:41:09.626393431 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/doc/dataset_basics.rdoc 2024-05-02 02:41:09.746394106 +0000
@@ -68 +68 @@
-SELECT:: select, select_all, select_append, select_group, select_more
+SELECT:: select, select_all, select_append, select_group, select_more, select_prepend
doc/opening_databases.rdoc
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/doc/opening_databases.rdoc 2024-05-02 02:41:09.630393452 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/doc/opening_databases.rdoc 2024-05-02 02:41:09.750394128 +0000
@@ -348,0 +349,2 @@
+:unlogged_tables_default :: Set to true to use UNLOGGED by default for created tables, for potentially better performance
+ when data integrity is not important.
doc/querying.rdoc
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/doc/querying.rdoc 2024-05-02 02:41:09.630393452 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/doc/querying.rdoc 2024-05-02 02:41:09.750394128 +0000
@@ -627 +627 @@
-To add to the existing selected columns, use +select_append+:
+To append to the existing selected columns, use +select_append+:
@@ -630,0 +631,5 @@
+
+To prepend to the existing selected columns, use +select_prepend+:
+
+ Artist.select(:id).select_prepend(:name)
+ # SELECT name, id FROM artists
doc/schema_modification.rdoc
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/doc/schema_modification.rdoc 2024-05-02 02:41:09.642393520 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/doc/schema_modification.rdoc 2024-05-02 02:41:09.794394376 +0000
@@ -84,2 +84,2 @@
-When using the type name as method, the third argument is an options hash, and when using the +column+
-method, the fourth argument is the options hash. The following options are supported:
+When using the type name as method, the second argument is an options hash, and when using the +column+
+method, the third argument is the options hash. The following options are supported:
lib/sequel/adapters/shared/mssql.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/adapters/shared/mssql.rb 2024-05-02 02:41:09.650393565 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/adapters/shared/mssql.rb 2024-05-02 02:41:09.870394804 +0000
@@ -35 +35 @@
- # hash keyed by argument named. For unnamed arguments, this should be an
+ # hash keyed by argument name. For unnamed arguments, this should be an
@@ -248,0 +249,28 @@
+ # Attempt to acquire an exclusive advisory lock with the given lock_id (which will
+ # be converted to a string). If successful, yield to the block, then release the advisory lock
+ # when the block exits. If unsuccessful, raise a Sequel::AdvisoryLockError.
+ #
+ # Options:
+ # :wait :: Do not raise an error, instead, wait until the advisory lock can be acquired.
+ def with_advisory_lock(lock_id, opts=OPTS)
+ lock_id = lock_id.to_s
+ timeout = opts[:wait] ? -1 : 0
+ server = opts[:server]
+
+ synchronize(server) do
+ begin
+ res = call_mssql_sproc(:sp_getapplock, :server=>server, :args=>{'Resource'=>lock_id, 'LockTimeout'=>timeout, 'LockMode'=>'Exclusive', 'LockOwner'=>'Session'})
+
+ unless locked = res[:result] >= 0
+ raise AdvisoryLockError, "unable to acquire advisory lock #{lock_id.inspect}"
+ end
+
+ yield
+ ensure
+ if locked
+ call_mssql_sproc(:sp_releaseapplock, :server=>server, :args=>{'Resource'=>lock_id, 'LockOwner'=>'Session'})
+ end
+ end
+ end
+ end
+
lib/sequel/adapters/shared/mysql.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/adapters/shared/mysql.rb 2024-05-02 02:41:09.650393565 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/adapters/shared/mysql.rb 2024-05-02 02:41:09.870394804 +0000
@@ -199,0 +200,35 @@
+ # Attempt to acquire an exclusive advisory lock with the given lock_id (which will be
+ # converted to a string). If successful, yield to the block, then release the advisory lock
+ # when the block exits. If unsuccessful, raise a Sequel::AdvisoryLockError.
+ #
+ # DB.with_advisory_lock(1357){DB.get(1)}
+ # # SELECT GET_LOCK('1357', 0) LIMIT 1
+ # # SELECT 1 AS v LIMIT 1
+ # # SELECT RELEASE_LOCK('1357') LIMIT 1
+ #
+ # Options:
+ # :wait :: Do not raise an error, instead, wait until the advisory lock can be acquired.
+ def with_advisory_lock(lock_id, opts=OPTS)
+ lock_id = lock_id.to_s
+ ds = dataset
+ if server = opts[:server]
+ ds = ds.server(server)
+ end
+
+ # MariaDB doesn't support negative values for infinite wait. A wait of 34 years
+ # should be reasonably similar to infinity for this case.
+ timeout = opts[:wait] ? 1073741823 : 0
+
+ synchronize(server) do |c|
+ begin
+ unless locked = ds.get{GET_LOCK(lock_id, timeout)} == 1
+ raise AdvisoryLockError, "unable to acquire advisory lock #{lock_id.inspect}"
+ end
+
+ yield
+ ensure
+ ds.get{RELEASE_LOCK(lock_id)} if locked
+ end
+ end
+ end
+
@@ -894 +929 @@
- # MySQL 8+ supports SKIP LOCKED.
+ # MySQL 8+ and MariaDB 10.6+ support SKIP LOCKED.
@@ -896 +931 @@
- !db.mariadb? && db.server_version >= 80000
+ db.server_version >= (db.mariadb? ? 100600 : 80000)
lib/sequel/adapters/shared/postgres.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/adapters/shared/postgres.rb 2024-05-02 02:41:09.650393565 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/adapters/shared/postgres.rb 2024-05-02 02:41:09.870394804 +0000
@@ -861,0 +862,35 @@
+ # Attempt to acquire an exclusive advisory lock with the given lock_id (which should be
+ # a 64-bit integer). If successful, yield to the block, then release the advisory lock
+ # when the block exits. If unsuccessful, raise a Sequel::AdvisoryLockError.
+ #
+ # DB.with_advisory_lock(1347){DB.get(1)}
+ # # SELECT pg_try_advisory_lock(1357) LIMIT 1
+ # # SELECT 1 AS v LIMIT 1
+ # # SELECT pg_advisory_unlock(1357) LIMIT 1
+ #
+ # Options:
+ # :wait :: Do not raise an error, instead, wait until the advisory lock can be acquired.
+ def with_advisory_lock(lock_id, opts=OPTS)
+ ds = dataset
+ if server = opts[:server]
+ ds = ds.server(server)
+ end
+
+ synchronize(server) do |c|
+ begin
+ if opts[:wait]
+ ds.get{pg_advisory_lock(lock_id)}
+ locked = true
+ else
+ unless locked = ds.get{pg_try_advisory_lock(lock_id)}
+ raise AdvisoryLockError, "unable to acquire advisory lock #{lock_id.inspect}"
+ end
+ end
+
+ yield
+ ensure
+ ds.get{pg_advisory_unlock(lock_id)} if locked
+ end
+ end
+ end
+
@@ -1393 +1428 @@
- elsif options[:unlogged]
+ elsif options.fetch(:unlogged){typecast_value_boolean(@opts[:unlogged_tables_default])}
@@ -1788 +1823 @@
- Dataset.def_sql_method(self, :select, [['if opts[:values]', %w'values order limit'], ['elsif server_version >= 80400', %w'with select distinct columns from join where group having window compounds order limit lock'], ['else', %w'select distinct columns from join where group having compounds order limit lock']])
+ Dataset.def_sql_method(self, :select, [['if opts[:values]', %w'values compounds order limit'], ['elsif server_version >= 80400', %w'with select distinct columns from join where group having window compounds order limit lock'], ['else', %w'select distinct columns from join where group having compounds order limit lock']])
lib/sequel/database/misc.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/database/misc.rb 2024-05-02 02:41:09.654393589 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/database/misc.rb 2024-05-02 02:41:09.874394826 +0000
@@ -151,0 +152 @@
+ @transactions.compare_by_identity
lib/sequel/database/schema_methods.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/database/schema_methods.rb 2024-05-02 02:41:09.654393589 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/database/schema_methods.rb 2024-05-02 02:41:09.878394850 +0000
@@ -255 +255 @@
- if supports_create_or_replace_view?
+ if supports_create_or_replace_view? && !options[:materialized]
@@ -258 +258 @@
- swallow_database_error{drop_view(name)}
+ swallow_database_error{drop_view(name, options)}
lib/sequel/dataset/dataset_module.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/dataset/dataset_module.rb 2024-05-02 02:41:09.658393611 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/dataset/dataset_module.rb 2024-05-02 02:41:09.878394850 +0000
@@ -24 +24 @@
- select select_all select_append select_group server
+ select select_all select_append select_group select_prepend server
lib/sequel/dataset/graph.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/dataset/graph.rb 2024-05-02 02:41:09.658393611 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/dataset/graph.rb 2024-05-02 02:41:09.878394850 +0000
@@ -255,0 +256 @@
+ return self unless opts[:graph]
lib/sequel/dataset/query.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/dataset/query.rb 2024-05-02 02:41:09.710393904 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/dataset/query.rb 2024-05-02 02:41:09.878394850 +0000
@@ -46 +46 @@
- reverse reverse_order select select_all select_append select_group select_more server
+ reverse reverse_order select select_all select_append select_group select_more select_prepend server
@@ -131,0 +132 @@
+ return self if opts[:distinct] == EMPTY_ARRAY
@@ -232,0 +234 @@
+ return self if opts[:lock] == :update
@@ -643,0 +646 @@
+ return self if opts[:lateral]
@@ -746,0 +750 @@
+ return self unless opts[:row_proc]
@@ -755,0 +760 @@
+ return self if opts[:nowait]
@@ -880,0 +886 @@
+ return self if opts[:returning] == EMPTY_ARRAY
@@ -932,0 +939 @@
+ return self unless opts[:select]
@@ -947,8 +954,2 @@
- cur_sel = @opts[:select]
- if !cur_sel || cur_sel.empty?
- unless supports_select_all_and_column?
- return select_all(*(Array(@opts[:from]) + Array(@opts[:join]))).select_append(*columns, &block)
- end
- cur_sel = [WILDCARD]
- end
- select(*(cur_sel + columns), &block)
+ virtual_row_columns(columns, block)
+ select(*(_current_select(true) + columns))
@@ -975,0 +977,12 @@
+ # Returns a copy of the dataset with the given columns added
+ # to the existing selected columns. If no columns are currently selected,
+ # it will select the columns given in addition to *.
+ #
+ # DB[:items].select(:a).select(:b) # SELECT b FROM items
+ # DB[:items].select(:a).select_prepend(:b) # SELECT b, a FROM items
+ # DB[:items].select_prepend(:b) # SELECT b, * FROM items
+ def select_prepend(*columns, &block)
+ virtual_row_columns(columns, block)
+ select(*(columns + _current_select(false)))
+ end
+
@@ -1001,0 +1015 @@
+ return self if opts[:skip_limit_check]
@@ -1008,0 +1023 @@
+ return self if opts[:skip_locked]
@@ -1019,0 +1035 @@
+ return self unless opts[:where] || opts[:having]
@@ -1027,0 +1044 @@
+ return self unless opts[:group] || opts[:having]
@@ -1054,0 +1072 @@
+ return self unless opts[:limit] || opts[:offset]
@@ -1061,0 +1080 @@
+ return self unless opts[:order]
@@ -1354,0 +1374,30 @@
+
+ # A frozen array for the currently selected columns.
+ def _current_select(allow_plain_wildcard)
+ cur_sel = @opts[:select]
+
+ if !cur_sel || cur_sel.empty?
+ cur_sel = if allow_plain_wildcard && supports_select_all_and_column?
+ [WILDCARD].freeze
+ else
+ _current_select_column_all
+ end
+ elsif !allow_plain_wildcard && cur_sel.include?(WILDCARD)
+ cur_sel = cur_sel.dup
+ index = cur_sel.index(WILDCARD)
+ cur_sel.delete(WILDCARD)
+ _current_select_column_all.each_with_index do |ca, i|
+ cur_sel.insert(index+i, ca)
+ end
+ cur_sel.freeze
+ end
+
+ cur_sel
+ end
+
+ # An array of SQL::ColumnAll objects for all FROM and JOIN tables. Used for select_append
+ # and select_prepend.
+ def _current_select_column_all
+ tables = Array(@opts[:from]) + Array(@opts[:join])
+ tables.map{|t| i, a = split_alias(t); a || i}.map!{|t| SQL::ColumnAll.new(t)}.freeze
+ end
lib/sequel/exceptions.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/exceptions.rb 2024-05-02 02:41:09.710393904 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/exceptions.rb 2024-05-02 02:41:09.878394850 +0000
@@ -20,0 +21,5 @@
+
+ (
+ # Error raised when there is a failed attempt to acquire an advisory lock.
+ AdvisoryLockError = Class.new(Error)
+ ).name
lib/sequel/extensions/async_thread_pool.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/extensions/async_thread_pool.rb 2024-05-02 02:41:09.710393904 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/extensions/async_thread_pool.rb 2024-05-02 02:41:09.882394871 +0000
@@ -178,0 +179,7 @@
+# Note that the async_thread_pool extension creates the thread pool
+# when it is loaded into the Database. If you fork after loading
+# the extension, the extension will not work, as fork does not
+# copy the thread pools. If you are using a forking webserver
+# (or any other system that forks worker processes), load this
+# extension in each child process, do not load it before forking.
+#
lib/sequel/extensions/caller_logging.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/extensions/caller_logging.rb 2024-05-02 02:41:09.710393904 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/extensions/caller_logging.rb 2024-05-02 02:41:09.882394871 +0000
@@ -38,0 +39 @@
+ RUBY_STDLIB = RbConfig::CONFIG["rubylibdir"]
@@ -62 +63 @@
- line.start_with?(RbConfig::CONFIG["rubylibdir"]) ||
+ line.start_with?(RUBY_STDLIB) ||
lib/sequel/extensions/migration.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/extensions/migration.rb 2024-05-02 02:41:09.718393948 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/extensions/migration.rb 2024-05-02 02:41:09.886394895 +0000
@@ -405,0 +406,5 @@
+ # Lock ID to use for advisory locks when running migrations
+ # "sequel-migration".codepoints.reduce(:*) % (2**63)
+ MIGRATION_ADVISORY_LOCK_ID = 4966325471869609408
+ private_constant :MIGRATION_ADVISORY_LOCK_ID
+
@@ -418,0 +424,2 @@
+ # :use_advisory_lock :: Use advisory locks in migrations (only use this if Sequel supports advisory
+ # locks for the database).
@@ -426 +433,5 @@
- migrator_class(directory).new(db, directory, opts).run
+ if opts[:use_advisory_lock]
+ db.with_advisory_lock(MIGRATION_ADVISORY_LOCK_ID){run(db, directory, opts.merge(:use_advisory_lock=>false))}
+ else
+ migrator_class(directory).new(db, directory, opts).run
+ end
lib/sequel/extensions/sqlite_json_ops.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/extensions/sqlite_json_ops.rb 2024-05-02 02:41:09.722393971 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/extensions/sqlite_json_ops.rb 2024-05-02 02:41:09.894394939 +0000
@@ -5 +5,2 @@
-# first in SQLite 3.38.0).
+# first in SQLite 3.38.0). It also supports the SQLite JSONB functions
+# added in SQLite 3.45.0.
@@ -11,2 +12,3 @@
-# This extension works by calling methods on Sequel::SQLite::JSONOp objects,
-# which you can create via Sequel.sqlite_json_op:
+# This extension works by calling methods on Sequel::SQLite::JSONOp and
+# Sequel::SQLite::JSONBOp objects, which you can create using
+# Sequel.sqlite_json_op and Sequel.sqlite_jsonb_op:
@@ -14,0 +17 @@
+# jb = Sequel.sqlite_jsonb_op(:jsonb_column)
@@ -16,2 +19,3 @@
-# Also, on most Sequel expression objects, you can call the sqlite_json_op method
-# to create a Sequel::SQLite::JSONOp object:
+# Also, on most Sequel expression objects, you can call the sqlite_json_op or
+# sqlite_jsonb_op method to create a Sequel::SQLite::JSONOp or
+# Sequel::SQLite::JSONBOp object:
@@ -19,0 +24 @@
+# jb = Sequel[:jsonb_column].sqlite_jsonb_op
@@ -23,0 +29 @@
+# or Symbol#sqlite_jsonb_op:
@@ -25,0 +32 @@
+# jb = :json_column.sqlite_jsonb_op
@@ -32,0 +40 @@
+# jb.extract('$.a') # jsonb_extract(jsonb_column, '$.a')
@@ -37 +45,2 @@
-# j.json # json(json_column)
+# jb.json # json(jsonb_column)
+# j.jsonb # jsonb(json_column)
@@ -44,0 +54,6 @@
+# jb.insert('$.a', 1) # jsonb_insert(jsonb_column, '$.a', 1)
+# jb.set('$.a', 1) # jsonb_set(jsonb_column, '$.a', 1)
+# jb.replace('$.a', 1) # jsonb_replace(jsonb_column, '$.a', 1)
+# jb.remove('$.a') # jsonb_remove(jsonb_column, '$.a')
+# jb.patch('{"a":2}') # jsonb_patch(jsonb_column, '{"a":2}')
+#
@@ -48 +63,2 @@
-# Related modules: Sequel::SQLite::JSONOp
+# Related modules: Sequel::SQLite::JSONBaseOp, Sequel::SQLite::JSONOp,
+# Sequel::SQLite::JSONBOp
@@ -53,3 +69,4 @@
- # The JSONOp class is a simple container for a single object that
- # defines methods that yield Sequel expression objects representing
- # SQLite json operators and functions.
+ # JSONBaseOp is an abstract base wrapper class for a object that
+ # defines methods that return Sequel expression objects representing
+ # SQLite json operators and functions. It is subclassed by both
+ # JSONOp and JSONBOp for json and jsonb specific behavior.
@@ -60 +77 @@
- class JSONOp < Sequel::SQL::Wrapper
+ class JSONBaseOp < Sequel::SQL::Wrapper
@@ -85 +102 @@
- Sequel::SQL::NumericExpression.new(:NOOP, function(:array_length, *args))
+ Sequel::SQL::NumericExpression.new(:NOOP, SQL::Function.new(:json_array_length, self, *args))
@@ -95 +112 @@
- function(:each, *args)
+ SQL::Function.new(:json_each, self, *args)
@@ -132 +149 @@
- self.class.new(SQL::Function.new(:json, self))
+ JSONOp.new(SQL::Function.new(:json, self))
@@ -135,0 +153,7 @@
+ # Returns the JSONB format of the JSON.
+ #
+ # json_op.jsonb # jsonb(json)
+ def jsonb
+ JSONBOp.new(SQL::Function.new(:jsonb, self))
+ end
+
@@ -175 +199 @@
- function(:tree, *args)
+ SQL::Function.new(:json_tree, self, *args)
@@ -183 +207 @@
- Sequel::SQL::StringExpression.new(:NOOP, function(:type, *args))
+ Sequel::SQL::StringExpression.new(:NOOP, SQL::Function.new(:json_type, self, *args))
@@ -189 +213 @@
- Sequel::SQL::BooleanExpression.new(:NOOP, function(:valid))
+ Sequel::SQL::BooleanExpression.new(:NOOP, SQL::Function.new(:json_valid, self))
@@ -201 +225 @@
- SQL::Function.new("json_#{name}", self, *args)
+ SQL::Function.new("#{function_prefix}_#{name}", self, *args)
@@ -210,0 +235,18 @@
+ # JSONOp is used for SQLite json-specific functions and operators.
+ class JSONOp < JSONBaseOp
+ private
+
+ def function_prefix
+ "json"
+ end
+ end
+
+ # JSONOp is used for SQLite jsonb-specific functions and operators.
+ class JSONBOp < JSONBaseOp
+ private
+
+ def function_prefix
+ "jsonb"
+ end
+ end
+
@@ -216,0 +259,6 @@
+
+ # Wrap the receiver in an JSONBOp so you can easily use the SQLite
+ # jsonb functions and operators with it.
+ def sqlite_jsonb_op
+ JSONBOp.new(self)
+ end
@@ -227,0 +276,10 @@
+ end
+ end
+
+ # Return the object wrapped in an SQLite::JSONBOp.
+ def sqlite_jsonb_op(v)
+ case v
+ when SQLite::JSONBOp
+ v
+ else
+ SQLite::JSONBOp.new(v)
lib/sequel/model/base.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/model/base.rb 2024-05-02 02:41:09.726393994 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/model/base.rb 2024-05-02 02:41:09.894394939 +0000
@@ -20 +20 @@
- # select_hash_groups, select_map, select_more, select_order_map, server,
+ # select_hash_groups, select_map, select_more, select_order_map, select_prepend, server,
lib/sequel/version.rb
--- /tmp/d20240502-2464-u3532e/sequel-5.77.0/lib/sequel/version.rb 2024-05-02 02:41:09.746394106 +0000
+++ /tmp/d20240502-2464-u3532e/sequel-5.80.0/lib/sequel/version.rb 2024-05-02 02:41:09.914395052 +0000
@@ -9 +9 @@
- MINOR = 77
+ MINOR = 80 |
dependabot
bot
force-pushed
the
dependabot/bundler/sequel-5.80.0
branch
from
May 16, 2024 21:38
213b693
to
b039bc1
Compare
Bumps [sequel](https://github.com/jeremyevans/sequel) from 5.77.0 to 5.80.0. - [Changelog](https://github.com/jeremyevans/sequel/blob/master/CHANGELOG) - [Commits](jeremyevans/sequel@5.77.0...5.80.0) --- updated-dependencies: - dependency-name: sequel dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
dependabot
bot
force-pushed
the
dependabot/bundler/sequel-5.80.0
branch
from
May 22, 2024 20:15
b039bc1
to
6914b66
Compare
Superseded by #636. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bumps sequel from 5.77.0 to 5.80.0.
Changelog
Sourced from sequel's changelog.
Commits
1549236
Bump version to 5.80.0e437cef
Avoid use of method chaining in provenance spec2dd31a7
Simplify supports_skip_locked? in shared MySQL adapter917d0e6
Support SKIP LOCKED for MariaDB 10.6+.163730e
Try to make provenance extension specs pass on JRuby 9.2 and 9.3c4e43e2
Avoid allocating datasets in cases where the returned dataset would be the sa...559fea3
Add RUBY_STDLIB constant to CallerLogging modulee1078c4
Add provenance dataset extension, which includes comments in queries showing ...4314aeb
Bump version to 5.79.000fbc7a
Add links to sequel-talk on the mail-archive.comDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)