sequel 5.78.0 → 5.79.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +8 -0
- data/README.rdoc +5 -3
- data/doc/dataset_basics.rdoc +1 -1
- data/doc/opening_databases.rdoc +2 -0
- data/doc/querying.rdoc +6 -1
- data/doc/release_notes/5.79.0.txt +28 -0
- data/lib/sequel/adapters/shared/postgres.rb +1 -1
- data/lib/sequel/database/schema_methods.rb +2 -2
- data/lib/sequel/dataset/dataset_module.rb +1 -1
- data/lib/sequel/dataset/query.rb +45 -9
- data/lib/sequel/model/base.rb +1 -1
- data/lib/sequel/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 154517820668c8c59f141797157a9945ae3afaeb482e997619e68e9bebc5c70a
|
4
|
+
data.tar.gz: c7991308e696d0f931f46cf38c301986c9094a44bca94a1d6749a0b798cb1d9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7efb6286d8eded4c0064199f7335e9cd2b0575942fd52040b29c52e26498d1531168435d86ca6e42474512ac21c1b151db85dd4db0fa5ff6b3f90dad73568a3b
|
7
|
+
data.tar.gz: 7ef17f79333fdabe90485b105fdc24925c8c75f41dc78f83f5400ebc39b0ac2b3709881624086526559132c8346c1dc8f07b9384a39bb838d1132bf4a7040ec1
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 5.79.0 (2024-04-01)
|
2
|
+
|
3
|
+
* Support create_or_replace_view with :materialized option on PostgreSQL (nashby) (#2144)
|
4
|
+
|
5
|
+
* Support :unlogged_tables_default Database option on Postgres for making created tables unlogged by default (jeremyevans) (#2134)
|
6
|
+
|
7
|
+
* Add Dataset#select_prepend for prepending to the current selected columns (jeremyevans) (#2139)
|
8
|
+
|
1
9
|
=== 5.78.0 (2024-03-01)
|
2
10
|
|
3
11
|
* Support SQLite 3.45+ jsonb functions in the sqlite_json_ops extension (jeremyevans) (#2133)
|
data/README.rdoc
CHANGED
@@ -22,10 +22,10 @@ RDoc Documentation :: https://sequel.jeremyevans.net/rdoc
|
|
22
22
|
Source Code :: https://github.com/jeremyevans/sequel
|
23
23
|
Bug tracking (GitHub Issues) :: https://github.com/jeremyevans/sequel/issues
|
24
24
|
Discussion Forum (GitHub Discussions) :: https://github.com/jeremyevans/sequel/discussions
|
25
|
-
|
25
|
+
Archived Discussion Forum (sequel-talk Google Group) :: https://www.mail-archive.com/sequel-talk@googlegroups.com/
|
26
26
|
|
27
27
|
If you have questions about how to use Sequel, please ask on
|
28
|
-
GitHub Discussions
|
28
|
+
GitHub Discussions.
|
29
29
|
Only use the the bug tracker to report
|
30
30
|
bugs in Sequel, not to ask for help on using Sequel.
|
31
31
|
|
@@ -368,10 +368,12 @@ Like +order+, +select+ overrides an existing selection:
|
|
368
368
|
posts.select(:stamp).select(:name)
|
369
369
|
# SELECT name FROM posts
|
370
370
|
|
371
|
-
As you might expect, there
|
371
|
+
As you might expect, there are +order_append+ and +order_prepend+ equivalents for +select+ called +select_append+ and +select_prepend+:
|
372
372
|
|
373
373
|
posts.select(:stamp).select_append(:name)
|
374
374
|
# SELECT stamp, name FROM posts
|
375
|
+
posts.select(:stamp).select_prepend(:name)
|
376
|
+
# SELECT name, stamp FROM posts
|
375
377
|
|
376
378
|
=== Deleting Records
|
377
379
|
|
data/doc/dataset_basics.rdoc
CHANGED
@@ -65,7 +65,7 @@ Most Dataset methods that users will use can be broken down into two types:
|
|
65
65
|
|
66
66
|
Most dataset methods fall into this category, which can be further broken down by the clause they affect:
|
67
67
|
|
68
|
-
SELECT:: select, select_all, select_append, select_group, select_more
|
68
|
+
SELECT:: select, select_all, select_append, select_group, select_more, select_prepend
|
69
69
|
FROM:: from, from_self
|
70
70
|
JOIN:: join, left_join, right_join, full_join, natural_join, natural_left_join, natural_right_join, natural_full_join, cross_join, inner_join, left_outer_join, right_outer_join, full_outer_join, join_table
|
71
71
|
WHERE:: where, filter, exclude, or, grep, invert, unfiltered
|
data/doc/opening_databases.rdoc
CHANGED
@@ -346,6 +346,8 @@ The following additional options are supported:
|
|
346
346
|
separated by commas (for use via a URL: <tt>postgres:///?search_path=schema1,schema2</tt>), or it
|
347
347
|
can be an array of strings (for use via an option:
|
348
348
|
<tt>Sequel.postgres(search_path: ['schema1', 'schema2'])</tt>).
|
349
|
+
:unlogged_tables_default :: Set to true to use UNLOGGED by default for created tables, for potentially better performance
|
350
|
+
when data integrity is not important.
|
349
351
|
:use_iso_date_format :: This can be set to false to not force the ISO date format. Sequel forces
|
350
352
|
it by default to allow for an optimization.
|
351
353
|
|
data/doc/querying.rdoc
CHANGED
@@ -624,11 +624,16 @@ Like +order+, +select+ replaces the existing selected columns:
|
|
624
624
|
Artist.select(:id).select(:name)
|
625
625
|
# SELECT name FROM artists
|
626
626
|
|
627
|
-
To
|
627
|
+
To append to the existing selected columns, use +select_append+:
|
628
628
|
|
629
629
|
Artist.select(:id).select_append(:name)
|
630
630
|
# SELECT id, name FROM artists
|
631
631
|
|
632
|
+
To prepend to the existing selected columns, use +select_prepend+:
|
633
|
+
|
634
|
+
Artist.select(:id).select_prepend(:name)
|
635
|
+
# SELECT name, id FROM artists
|
636
|
+
|
632
637
|
To remove specifically selected columns, and default back to all
|
633
638
|
columns, use +select_all+:
|
634
639
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* Dataset#select_prepend has been added for prepending to the
|
4
|
+
currently selected columns:
|
5
|
+
|
6
|
+
DB[:table].select_prepend(:column)
|
7
|
+
# SELECT column, table.*
|
8
|
+
|
9
|
+
As not all databases support "SELECT column, *", select_prepend
|
10
|
+
qualifies wildcard selections to all tables referenced in the
|
11
|
+
query.
|
12
|
+
|
13
|
+
The only reason to use select_prepend is if you want the hashes
|
14
|
+
returned by Sequel to be in a specific order. Otherwise, it is
|
15
|
+
better to use select_append.
|
16
|
+
|
17
|
+
* On PostgreSQL, Sequel now supports an :unlogged_tables_default
|
18
|
+
Database option, which will default created tables to be UNLOGGED.
|
19
|
+
This can be useful to speedup testing in some cases, but it should
|
20
|
+
never be used in cases where data integrity is important.
|
21
|
+
|
22
|
+
= Other Improvements
|
23
|
+
|
24
|
+
* On PostgreSQL, Database#create_or_replace_view now supports the
|
25
|
+
:materialized option. This allows for dropping an existing
|
26
|
+
materialized view and creating a new one with the same name
|
27
|
+
(PostgreSQL does not have native support for replacing materialized
|
28
|
+
views).
|
@@ -1425,7 +1425,7 @@ module Sequel
|
|
1425
1425
|
elsif options[:foreign]
|
1426
1426
|
raise(Error, "can't provide both :foreign and :unlogged to create_table") if options[:unlogged]
|
1427
1427
|
'FOREIGN '
|
1428
|
-
elsif options[:
|
1428
|
+
elsif options.fetch(:unlogged){typecast_value_boolean(@opts[:unlogged_tables_default])}
|
1429
1429
|
'UNLOGGED '
|
1430
1430
|
end
|
1431
1431
|
|
@@ -252,10 +252,10 @@ module Sequel
|
|
252
252
|
# For databases where replacing a view is not natively supported, support
|
253
253
|
# is emulated by dropping a view with the same name before creating the view.
|
254
254
|
def create_or_replace_view(name, source, options = OPTS)
|
255
|
-
if supports_create_or_replace_view?
|
255
|
+
if supports_create_or_replace_view? && !options[:materialized]
|
256
256
|
options = options.merge(:replace=>true)
|
257
257
|
else
|
258
|
-
swallow_database_error{drop_view(name)}
|
258
|
+
swallow_database_error{drop_view(name, options)}
|
259
259
|
end
|
260
260
|
|
261
261
|
create_view(name, source, options)
|
@@ -21,7 +21,7 @@ module Sequel
|
|
21
21
|
where exclude exclude_having having
|
22
22
|
distinct grep group group_and_count group_append
|
23
23
|
limit offset order order_append order_prepend reverse
|
24
|
-
select select_all select_append select_group server
|
24
|
+
select select_all select_append select_group select_prepend server
|
25
25
|
METHS
|
26
26
|
|
27
27
|
# Define a method in the module
|
data/lib/sequel/dataset/query.rb
CHANGED
@@ -43,7 +43,7 @@ module Sequel
|
|
43
43
|
add_graph_aliases distinct except exclude exclude_having
|
44
44
|
filter for_update from from_self graph grep group group_and_count group_append group_by having intersect invert
|
45
45
|
limit lock_style naked offset or order order_append order_by order_more order_prepend qualify
|
46
|
-
reverse reverse_order select select_all select_append select_group select_more server
|
46
|
+
reverse reverse_order select select_all select_append select_group select_more select_prepend server
|
47
47
|
set_graph_aliases unfiltered ungraphed ungrouped union
|
48
48
|
unlimited unordered where with with_recursive with_sql
|
49
49
|
METHS
|
@@ -944,14 +944,8 @@ module Sequel
|
|
944
944
|
# DB[:items].select(:a).select_append(:b) # SELECT a, b FROM items
|
945
945
|
# DB[:items].select_append(:b) # SELECT *, b FROM items
|
946
946
|
def select_append(*columns, &block)
|
947
|
-
|
948
|
-
|
949
|
-
unless supports_select_all_and_column?
|
950
|
-
return select_all(*(Array(@opts[:from]) + Array(@opts[:join]))).select_append(*columns, &block)
|
951
|
-
end
|
952
|
-
cur_sel = [WILDCARD]
|
953
|
-
end
|
954
|
-
select(*(cur_sel + columns), &block)
|
947
|
+
virtual_row_columns(columns, block)
|
948
|
+
select(*(_current_select(true) + columns))
|
955
949
|
end
|
956
950
|
|
957
951
|
# Set both the select and group clauses with the given +columns+.
|
@@ -973,6 +967,18 @@ module Sequel
|
|
973
967
|
select_append(*columns, &block)
|
974
968
|
end
|
975
969
|
|
970
|
+
# Returns a copy of the dataset with the given columns added
|
971
|
+
# to the existing selected columns. If no columns are currently selected,
|
972
|
+
# it will select the columns given in addition to *.
|
973
|
+
#
|
974
|
+
# DB[:items].select(:a).select(:b) # SELECT b FROM items
|
975
|
+
# DB[:items].select(:a).select_prepend(:b) # SELECT b, a FROM items
|
976
|
+
# DB[:items].select_prepend(:b) # SELECT b, * FROM items
|
977
|
+
def select_prepend(*columns, &block)
|
978
|
+
virtual_row_columns(columns, block)
|
979
|
+
select(*(columns + _current_select(false)))
|
980
|
+
end
|
981
|
+
|
976
982
|
# Set the server for this dataset to use. Used to pick a specific database
|
977
983
|
# shard to run a query against, or to override the default (where SELECT uses
|
978
984
|
# :read_only database and all other queries use the :default database). This
|
@@ -1353,6 +1359,36 @@ module Sequel
|
|
1353
1359
|
end
|
1354
1360
|
# :nocov:
|
1355
1361
|
|
1362
|
+
# A frozen array for the currently selected columns.
|
1363
|
+
def _current_select(allow_plain_wildcard)
|
1364
|
+
cur_sel = @opts[:select]
|
1365
|
+
|
1366
|
+
if !cur_sel || cur_sel.empty?
|
1367
|
+
cur_sel = if allow_plain_wildcard && supports_select_all_and_column?
|
1368
|
+
[WILDCARD].freeze
|
1369
|
+
else
|
1370
|
+
_current_select_column_all
|
1371
|
+
end
|
1372
|
+
elsif !allow_plain_wildcard && cur_sel.include?(WILDCARD)
|
1373
|
+
cur_sel = cur_sel.dup
|
1374
|
+
index = cur_sel.index(WILDCARD)
|
1375
|
+
cur_sel.delete(WILDCARD)
|
1376
|
+
_current_select_column_all.each_with_index do |ca, i|
|
1377
|
+
cur_sel.insert(index+i, ca)
|
1378
|
+
end
|
1379
|
+
cur_sel.freeze
|
1380
|
+
end
|
1381
|
+
|
1382
|
+
cur_sel
|
1383
|
+
end
|
1384
|
+
|
1385
|
+
# An array of SQL::ColumnAll objects for all FROM and JOIN tables. Used for select_append
|
1386
|
+
# and select_prepend.
|
1387
|
+
def _current_select_column_all
|
1388
|
+
tables = Array(@opts[:from]) + Array(@opts[:join])
|
1389
|
+
tables.map{|t| i, a = split_alias(t); a || i}.map!{|t| SQL::ColumnAll.new(t)}.freeze
|
1390
|
+
end
|
1391
|
+
|
1356
1392
|
# If invert is true, invert the condition.
|
1357
1393
|
def _invert_filter(cond, invert)
|
1358
1394
|
if invert
|
data/lib/sequel/model/base.rb
CHANGED
@@ -17,7 +17,7 @@ module Sequel
|
|
17
17
|
# natural_join, natural_left_join, natural_right_join, offset, order, order_append, order_by,
|
18
18
|
# order_more, order_prepend, paged_each, qualify, reverse, reverse_order, right_join,
|
19
19
|
# right_outer_join, select, select_all, select_append, select_group, select_hash,
|
20
|
-
# select_hash_groups, select_map, select_more, select_order_map, server,
|
20
|
+
# select_hash_groups, select_map, select_more, select_order_map, select_prepend, server,
|
21
21
|
# single_record, single_record!, single_value, single_value!, sum, to_hash, to_hash_groups,
|
22
22
|
# truncate, unfiltered, ungraphed, ungrouped, union, unlimited, unordered, where, where_all,
|
23
23
|
# where_each, where_single_value, with, with_recursive, with_sql
|
data/lib/sequel/version.rb
CHANGED
@@ -6,7 +6,7 @@ module Sequel
|
|
6
6
|
|
7
7
|
# The minor version of Sequel. Bumped for every non-patch level
|
8
8
|
# release, generally around once a month.
|
9
|
-
MINOR =
|
9
|
+
MINOR = 79
|
10
10
|
|
11
11
|
# The tiny version of Sequel. Usually 0, only bumped for bugfix
|
12
12
|
# releases that fix regressions from previous versions.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.79.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|
@@ -225,6 +225,7 @@ extra_rdoc_files:
|
|
225
225
|
- doc/release_notes/5.76.0.txt
|
226
226
|
- doc/release_notes/5.77.0.txt
|
227
227
|
- doc/release_notes/5.78.0.txt
|
228
|
+
- doc/release_notes/5.79.0.txt
|
228
229
|
- doc/release_notes/5.8.0.txt
|
229
230
|
- doc/release_notes/5.9.0.txt
|
230
231
|
files:
|
@@ -331,6 +332,7 @@ files:
|
|
331
332
|
- doc/release_notes/5.76.0.txt
|
332
333
|
- doc/release_notes/5.77.0.txt
|
333
334
|
- doc/release_notes/5.78.0.txt
|
335
|
+
- doc/release_notes/5.79.0.txt
|
334
336
|
- doc/release_notes/5.8.0.txt
|
335
337
|
- doc/release_notes/5.9.0.txt
|
336
338
|
- doc/schema_modification.rdoc
|