sequel 4.1.1 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +32 -0
  3. data/doc/opening_databases.rdoc +4 -0
  4. data/doc/release_notes/4.2.0.txt +129 -0
  5. data/lib/sequel/adapters/jdbc/hsqldb.rb +5 -0
  6. data/lib/sequel/adapters/mysql2.rb +2 -1
  7. data/lib/sequel/adapters/postgres.rb +8 -4
  8. data/lib/sequel/adapters/shared/db2.rb +5 -0
  9. data/lib/sequel/adapters/shared/mssql.rb +15 -4
  10. data/lib/sequel/adapters/shared/mysql.rb +1 -0
  11. data/lib/sequel/adapters/shared/oracle.rb +1 -1
  12. data/lib/sequel/adapters/shared/postgres.rb +10 -0
  13. data/lib/sequel/adapters/shared/sqlite.rb +5 -0
  14. data/lib/sequel/database/features.rb +6 -1
  15. data/lib/sequel/database/schema_methods.rb +3 -7
  16. data/lib/sequel/dataset/actions.rb +3 -4
  17. data/lib/sequel/dataset/features.rb +5 -0
  18. data/lib/sequel/dataset/misc.rb +28 -3
  19. data/lib/sequel/dataset/mutation.rb +37 -11
  20. data/lib/sequel/dataset/prepared_statements.rb +1 -3
  21. data/lib/sequel/dataset/query.rb +12 -3
  22. data/lib/sequel/dataset/sql.rb +12 -6
  23. data/lib/sequel/deprecated.rb +1 -1
  24. data/lib/sequel/extensions/columns_introspection.rb +1 -1
  25. data/lib/sequel/extensions/core_extensions.rb +0 -2
  26. data/lib/sequel/extensions/empty_array_ignore_nulls.rb +1 -1
  27. data/lib/sequel/extensions/filter_having.rb +1 -1
  28. data/lib/sequel/extensions/from_block.rb +31 -0
  29. data/lib/sequel/extensions/graph_each.rb +1 -1
  30. data/lib/sequel/extensions/hash_aliases.rb +1 -1
  31. data/lib/sequel/extensions/mssql_emulate_lateral_with_apply.rb +78 -0
  32. data/lib/sequel/extensions/pagination.rb +1 -1
  33. data/lib/sequel/extensions/pg_loose_count.rb +32 -0
  34. data/lib/sequel/extensions/pg_static_cache_updater.rb +133 -0
  35. data/lib/sequel/extensions/pretty_table.rb +1 -1
  36. data/lib/sequel/extensions/query.rb +3 -1
  37. data/lib/sequel/extensions/query_literals.rb +1 -1
  38. data/lib/sequel/extensions/select_remove.rb +1 -1
  39. data/lib/sequel/extensions/sequel_3_dataset_methods.rb +1 -1
  40. data/lib/sequel/extensions/set_overrides.rb +1 -1
  41. data/lib/sequel/model.rb +1 -1
  42. data/lib/sequel/model/base.rb +20 -6
  43. data/lib/sequel/model/exceptions.rb +1 -1
  44. data/lib/sequel/plugins/composition.rb +9 -0
  45. data/lib/sequel/plugins/dirty.rb +19 -8
  46. data/lib/sequel/plugins/instance_filters.rb +9 -0
  47. data/lib/sequel/plugins/serialization.rb +9 -0
  48. data/lib/sequel/plugins/serialization_modification_detection.rb +9 -0
  49. data/lib/sequel/plugins/static_cache.rb +96 -28
  50. data/lib/sequel/version.rb +2 -2
  51. data/spec/adapters/mssql_spec.rb +1 -1
  52. data/spec/adapters/postgres_spec.rb +70 -0
  53. data/spec/core/dataset_spec.rb +58 -1
  54. data/spec/core/deprecated_spec.rb +1 -1
  55. data/spec/core/schema_spec.rb +18 -0
  56. data/spec/extensions/composition_spec.rb +7 -0
  57. data/spec/extensions/dirty_spec.rb +9 -0
  58. data/spec/extensions/from_block_spec.rb +21 -0
  59. data/spec/extensions/instance_filters_spec.rb +6 -0
  60. data/spec/extensions/pg_loose_count_spec.rb +17 -0
  61. data/spec/extensions/pg_static_cache_updater_spec.rb +80 -0
  62. data/spec/extensions/query_spec.rb +8 -0
  63. data/spec/extensions/serialization_modification_detection_spec.rb +9 -0
  64. data/spec/extensions/serialization_spec.rb +7 -0
  65. data/spec/extensions/set_overrides_spec.rb +12 -0
  66. data/spec/extensions/static_cache_spec.rb +314 -154
  67. data/spec/integration/dataset_test.rb +12 -2
  68. data/spec/integration/schema_test.rb +13 -0
  69. data/spec/model/record_spec.rb +74 -0
  70. metadata +13 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e97437793fba5f6d584ca832d9188c5779809da
4
- data.tar.gz: bf8b6218bf26ea9dc03387724dc904951e0f81d9
3
+ metadata.gz: cab63d0878683dcadae2a2192c6969b1afd46a8d
4
+ data.tar.gz: c06204a0ba11736b055e57e109b7d8886014dd8e
5
5
  SHA512:
6
- metadata.gz: 8fd114ba94ddf1c53718cbf10b8454dac4ad8cceec47414dca2fbd4a21527f7bfd2f2f3811d18f2bf7035631701c7fa54f352af593517f283e09f8f991cc17da
7
- data.tar.gz: b171c79c198bd268e1aee3ff16a26369bfcb0eac4abf5787fc47bf0a1cd16dfa95919ded5455fac1dd4d7290bc3066d58df38cd128c1183a7ca593dff531c12c
6
+ metadata.gz: 03ea44b1eb6d126258b335e3e28935506360c8d1e2e54c773d26b9f5e795b71f6f8c27eb04ad1fe6dd0deb32d86c42b88ac11b6e9356b735dc54b791310e16d8
7
+ data.tar.gz: 7d4084003d7202c8507ae31746f0e941a23a187edd8f479b22994a100283b5671982ab877aa4cb72029a846a899e8e356be0f14c7161361994913963547de1a6
data/CHANGELOG CHANGED
@@ -1,3 +1,35 @@
1
+ === 4.2.0 (2013-09-01)
2
+
3
+ * Support custom :flags option in mysql2 adapter (jeremyevans) (#700)
4
+
5
+ * Add implementations of Dataset#freeze and Dataset#dup (jeremyevans)
6
+
7
+ * Add implementations of Model#dup and Model#clone (jeremyevans)
8
+
9
+ * Don't have partial_indexes returned by Database#indexes on MSSQL 2008+ (jeremyevans)
10
+
11
+ * Support partial indexes on SQLite 3.8.0+ (jeremyevans)
12
+
13
+ * Add Database#supports_partial_indexes? to check for partial index support (mluu, jeremyevans) (#698)
14
+
15
+ * The static_cache plugin now disallows saving/destroying if the :frozen=>false option is not used (jeremyevans)
16
+
17
+ * Support :frozen=>false option in static_cache plugin, for having new instances returned instead of frozen cached instances (jeremyevans)
18
+
19
+ * Add pg_static_cache_updater Database extension for listening for changes to tables and updating static_cache caches automatically (jeremyevans)
20
+
21
+ * Add mssql_emulate_lateral_with_apply extension for emulating LATERAL queries using CROSS/OUTER APPLY (jeremyevans)
22
+
23
+ * Support LATERAL queries via Dataset#lateral (jeremyevans)
24
+
25
+ * Add pg_loose_count Database extension, for fast approximate counts of PostgreSQL tables (jeremyevans)
26
+
27
+ * Add from_block Database extension, for having Database#from block affect FROM instead of WHERE (jeremyevans)
28
+
29
+ * Support :cursor_name option in postgres adapter Dataset#use_cursor (heeringa, jeremyevans) (#696)
30
+
31
+ * Fix placeholder literal strings when used with an empty placeholder hash (trydionel, jeremyevans) (#695)
32
+
1
33
  === 4.1.1 (2013-08-01)
2
34
 
3
35
  * Fix select_map, select_order_map, and single_value methods on eager_graphed datasets (jeremyevans)
@@ -312,6 +312,10 @@ This is a newer MySQL adapter that does typecasting in C, so it is often faster
312
312
  mysql adapter. Supports the same additional options as the mysql adapter, except for :compress, and uses
313
313
  :timeout instead of :read_timeout and :connect_timeout.
314
314
 
315
+ The following additional options are supported:
316
+
317
+ :flags :: Override the flags to use for the connection (e.g. ::Mysql2::Client::MULTI_STATEMENTS)
318
+
315
319
  === odbc
316
320
 
317
321
  The ODBC adapter allows you to connect to any database with the appropriate ODBC drivers installed.
@@ -0,0 +1,129 @@
1
+ = New Features
2
+
3
+ * LATERAL subqueries are now supported on PostgreSQL 9.3+, HSQLDB,
4
+ and DB2 via Dataset#lateral:
5
+
6
+ DB.from(:a, DB[:b].where(:c=>:a__d).lateral)
7
+ # SELECT * FROM a,
8
+ # LATERAL (SELECT * FROM b WHERE (c = a.d)) AS t1
9
+
10
+ You can use a similar syntax when joining tables:
11
+
12
+ DB[:a].cross_join(DB[:b].where(:c=>:a__d).lateral)
13
+ # SELECT * FROM a
14
+ # CROSS JOIN LATERAL (SELECT * FROM b WHERE (c = a.d)) AS t1
15
+
16
+ If you are using Microsoft SQL Server, you can use the new
17
+ mssql_emulate_lateral_with_apply extension to emulate LATERAL
18
+ subqueries via CROSS/OUTER APPLY.
19
+
20
+ * The static_cache plugin now supports a :frozen=>false option. When
21
+ this option is used, instead of returning the frozen cached values,
22
+ the model now returns new, unfrozen objects that can be modified.
23
+ Note that if you make any database modifications, you are
24
+ responsible for updating the cache manually.
25
+
26
+ * A pg_static_cache_updater extension has been added. This extension
27
+ can automatically update the caches used by the static_cache plugin,
28
+ whenever the underlying database table is updated, using PostgreSQL's
29
+ notification channels.
30
+
31
+ This works by defining triggers on the underlying model tables that
32
+ use NOTIFY, and spinning up a thread in your application processes
33
+ that uses LISTEN, and refreshes the cache for the related model
34
+ whenever it receives a notification that the underlying table has
35
+ been modified.
36
+
37
+ This extension should make it possible to use the static_cache plugin
38
+ with the :frozen=>false option for any table that is small and not
39
+ frequently updated.
40
+
41
+ * A from_block extension has been added that makes Database#from operate
42
+ like Dataset#from in regards to a passed block, allowing you to write
43
+ code like:
44
+
45
+ DB.from{table_returning_function(arg1, arg2)}
46
+
47
+ * Database#supports_partial_indexes? has been added for checking for
48
+ partial index support. Partial indexes are now supported on SQLite
49
+ 3.8.0+.
50
+
51
+ * A pg_loose_count extension has been added for fast approximate counts
52
+ of PostgreSQL tables. This uses the system tables and should be
53
+ fairly accurate if the table statistics are up to date:
54
+
55
+ DB.loose_count(:table)
56
+
57
+ * The Dataset#use_cursor method in the postgres adapter now supports
58
+ a :cursor_name option. You can set this option if you want to
59
+ use nested cursors.
60
+
61
+ * The mysql2 adapter now supports a :flags Database option allowing to
62
+ set custom mysql2 flags (e.g. ::Mysql2::Client::MULTI_STATEMENTS).
63
+
64
+ = Other Improvements
65
+
66
+ * Dataset#freeze has been implemented. Previously, it was not
67
+ implemented, so Object#freeze was used, which resulted in a dataset
68
+ that wasn't cloneable. Dataset#freeze now works as expected,
69
+ resulting in a cloneable dataset, but it doesn't allow methods to
70
+ be called that mutate the receiver.
71
+
72
+ * Dataset#dup has been implemented. Previously, it was not
73
+ implemented, so Object#dup was used, which resulted in a dataset
74
+ that shared an options hash with the receiver, so modifying the
75
+ dup's opts could also change the original dataset. Now dup works
76
+ similarly to clone, except that the returned object will not be
77
+ frozen.
78
+
79
+ * Model#dup has been implemented. Previously, it was not implemented,
80
+ so Object#dup was used, which resulted in a model instance that
81
+ shared the values hash with the receiver, so modifying the dup's
82
+ values also changed the original's values. Now, dup does a shallow
83
+ copy of some of the internal data structures as well, so the copy
84
+ is more independent.
85
+
86
+ Note that you still need to be careful if you mutate objects:
87
+
88
+ m = Model.new(:a=>'a')
89
+ m2 = m.dup
90
+ m.a.gsub!('a', 'b') # also changes m2
91
+
92
+ * Model#clone has been implemented. Previously, it had the same
93
+ issues as dup. Now, it calls the new Model#dup, but also
94
+ freezes the returned object if the receiver is frozen.
95
+
96
+ * Placeholder literal strings with an empty parameter hash are now
97
+ handled correctly.
98
+
99
+ = Backwards Compatibility
100
+
101
+ * The static_cache plugin now disallows saving/destroying instances
102
+ unless the :frozen=>false option is used. As the cached objects
103
+ returned by the model were frozen anyway, this affects creating
104
+ new instances or saving/destroying instances returned from the
105
+ underlying dataset.
106
+
107
+ * Model#set_values has been removed (it was deprecated starting in
108
+ Sequel 4.0).
109
+
110
+ * The following Model class methods are no longer defined:
111
+ insert_multiple, set, to_csv, paginate, query, set_overrides,
112
+ set_defaults. By default, these methods used call the
113
+ dataset method of the same name, but as those methods are no
114
+ longer defined on datasets by default, they also resulted in a
115
+ NoMethodError.
116
+
117
+ * Dataset#query!, #set_defaults!, and #set_overrides! are no longer
118
+ defined on all datasets. They are now only defined on datasets
119
+ that use the query or set_overrides extensions.
120
+
121
+ * Partial indexes are no longer returned by Database#indexes on MSSQL,
122
+ for consistency with PostgreSQL. Note that the same change was
123
+ desired for SQLite, but SQLite currently does not offer reflection
124
+ support for determining which indexes are partial.
125
+
126
+ * Database#foreign_key_list on MSSQL now will return a
127
+ SQL::QualifiedIdentifier instead of a symbol for the :table entry if
128
+ the schema of the referenced table does not match the schema of the
129
+ referencing table.
@@ -160,6 +160,11 @@ module Sequel
160
160
  false
161
161
  end
162
162
 
163
+ # HSQLDB supports lateral subqueries.
164
+ def supports_lateral_subqueries?
165
+ true
166
+ end
167
+
163
168
  private
164
169
 
165
170
  # Use string in hex format for blob data.
@@ -30,7 +30,8 @@ module Sequel
30
30
  opts = server_opts(server)
31
31
  opts[:host] ||= 'localhost'
32
32
  opts[:username] ||= opts.delete(:user)
33
- opts[:flags] = ::Mysql2::Client::FOUND_ROWS if ::Mysql2::Client.const_defined?(:FOUND_ROWS)
33
+ opts[:flags] ||= 0
34
+ opts[:flags] |= ::Mysql2::Client::FOUND_ROWS if ::Mysql2::Client.const_defined?(:FOUND_ROWS)
34
35
  conn = ::Mysql2::Client.new(opts)
35
36
  conn.query_options.merge!(:symbolize_keys=>true, :cache_rows=>false)
36
37
 
@@ -633,16 +633,19 @@ module Sequel
633
633
  #
634
634
  # * :rows_per_fetch - the number of rows per fetch (default 1000). Higher
635
635
  # numbers result in fewer queries but greater memory use.
636
+ # * :cursor_name - the name assigned to the cursor (default 'sequel_cursor').
637
+ # Nested cursors require different names.
636
638
  #
637
639
  # Usage:
638
640
  #
639
641
  # DB[:huge_table].use_cursor.each{|row| p row}
640
642
  # DB[:huge_table].use_cursor(:rows_per_fetch=>10000).each{|row| p row}
643
+ # DB[:huge_table].use_cursor(:cursor_name=>'my_cursor').each{|row| p row}
641
644
  #
642
645
  # This is untested with the prepared statement/bound variable support,
643
646
  # and unlikely to work with either.
644
647
  def use_cursor(opts=OPTS)
645
- clone(:cursor=>{:rows_per_fetch=>1000}.merge(opts))
648
+ clone(:cursor=>{:rows_per_fetch=>1000, :cursor_name => 'sequel_cursor'}.merge(opts))
646
649
  end
647
650
 
648
651
  if SEQUEL_POSTGRES_USES_PG
@@ -757,12 +760,13 @@ module Sequel
757
760
  # Use a cursor to fetch groups of records at a time, yielding them to the block.
758
761
  def cursor_fetch_rows(sql)
759
762
  server_opts = {:server=>@opts[:server] || :read_only}
763
+ cursor_name = quote_identifier(@opts[:cursor][:cursor_name])
760
764
  db.transaction(server_opts) do
761
765
  begin
762
- execute_ddl("DECLARE sequel_cursor NO SCROLL CURSOR WITHOUT HOLD FOR #{sql}", server_opts)
766
+ execute_ddl("DECLARE #{cursor_name} NO SCROLL CURSOR WITHOUT HOLD FOR #{sql}", server_opts)
763
767
  rows_per_fetch = @opts[:cursor][:rows_per_fetch].to_i
764
768
  rows_per_fetch = 1000 if rows_per_fetch <= 0
765
- fetch_sql = "FETCH FORWARD #{rows_per_fetch} FROM sequel_cursor"
769
+ fetch_sql = "FETCH FORWARD #{rows_per_fetch} FROM #{cursor_name}"
766
770
  cols = nil
767
771
  # Load columns only in the first fetch, so subsequent fetches are faster
768
772
  execute(fetch_sql) do |res|
@@ -777,7 +781,7 @@ module Sequel
777
781
  end
778
782
  end
779
783
  ensure
780
- execute_ddl("CLOSE sequel_cursor", server_opts)
784
+ execute_ddl("CLOSE #{cursor_name}", server_opts)
781
785
  end
782
786
  end
783
787
  end
@@ -293,6 +293,11 @@ module Sequel
293
293
  false
294
294
  end
295
295
 
296
+ # DB2 supports lateral subqueries
297
+ def supports_lateral_subqueries?
298
+ true
299
+ end
300
+
296
301
  # DB2 does not support multiple columns in IN.
297
302
  def supports_multiple_column_in?
298
303
  false
@@ -75,7 +75,7 @@ module Sequel
75
75
  referenced_schema = m.call(row[:schema])
76
76
  referenced_table = m.call(row[:table])
77
77
  h[row[:name]] = { :name => m.call(row[:name]),
78
- :table => (referenced_schema == current_schema) ? referenced_table : :"#{referenced_schema}__#{referenced_table}",
78
+ :table => (referenced_schema == current_schema) ? referenced_table : Sequel.qualify(referenced_schema, referenced_table),
79
79
  :columns => [m.call(row[:column])],
80
80
  :key => [m.call(row[:referenced_column])],
81
81
  :on_update => fk_action_map[row[:update_referential_action]],
@@ -90,15 +90,20 @@ module Sequel
90
90
  m = output_identifier_meth
91
91
  im = input_identifier_meth
92
92
  indexes = {}
93
- metadata_dataset.from(:sys__tables___t).
93
+ ds = metadata_dataset.from(:sys__tables___t).
94
94
  join(:sys__indexes___i, :object_id=>:object_id).
95
95
  join(:sys__index_columns___ic, :object_id=>:object_id, :index_id=>:index_id).
96
96
  join(:sys__columns___c, :object_id=>:object_id, :column_id=>:column_id).
97
97
  select(:i__name, :i__is_unique, :c__name___column).
98
98
  where{{t__name=>im.call(table)}}.
99
99
  where(:i__is_primary_key=>0, :i__is_disabled=>0).
100
- order(:i__name, :ic__index_column_id).
101
- each do |r|
100
+ order(:i__name, :ic__index_column_id)
101
+
102
+ if supports_partial_indexes?
103
+ ds = ds.where(:i__has_filter=>0)
104
+ end
105
+
106
+ ds.each do |r|
102
107
  index = indexes[m.call(r[:name])] ||= {:columns=>[], :unique=>(r[:is_unique] && r[:is_unique]!=0)}
103
108
  index[:columns] << m.call(r[:column])
104
109
  end
@@ -119,6 +124,11 @@ module Sequel
119
124
  @server_version
120
125
  end
121
126
 
127
+ # MSSQL 2008+ supports partial indexes.
128
+ def supports_partial_indexes?
129
+ dataset.send(:is_2008_or_later?)
130
+ end
131
+
122
132
  # MSSQL supports savepoints, though it doesn't support committing/releasing them savepoint
123
133
  def supports_savepoints?
124
134
  true
@@ -276,6 +286,7 @@ module Sequel
276
286
  # support for clustered index type
277
287
  def index_definition_sql(table_name, index)
278
288
  index_name = index[:name] || default_index_name(table_name, index[:columns])
289
+ raise Error, "Partial indexes are not supported for this database" if index[:where] && !supports_partial_indexes?
279
290
  if index[:type] == :full_text
280
291
  "CREATE FULLTEXT INDEX ON #{quote_schema_table(table_name)} #{literal(index[:columns])} KEY INDEX #{literal(index[:key_index])}"
281
292
  else
@@ -401,6 +401,7 @@ module Sequel
401
401
  # Handle MySQL specific index SQL syntax
402
402
  def index_definition_sql(table_name, index)
403
403
  index_name = quote_identifier(index[:name] || default_index_name(table_name, index[:columns]))
404
+ raise Error, "Partial indexes are not supported for this database" if index[:where] && !supports_partial_indexes?
404
405
  index_type = case index[:type]
405
406
  when :full_text
406
407
  "FULLTEXT "
@@ -56,7 +56,7 @@ module Sequel
56
56
  true
57
57
  end
58
58
 
59
- # DB2 supports transaction isolation levels.
59
+ # Oracle supports transaction isolation levels.
60
60
  def supports_transaction_isolation_levels?
61
61
  true
62
62
  end
@@ -470,6 +470,11 @@ module Sequel
470
470
  true
471
471
  end
472
472
 
473
+ # PostgreSQL supports partial indexes.
474
+ def supports_partial_indexes?
475
+ true
476
+ end
477
+
473
478
  # PostgreSQL supports prepared transactions (two-phase commit) if
474
479
  # max_prepared_transactions is greater than 0.
475
480
  def supports_prepared_transactions?
@@ -1238,6 +1243,11 @@ module Sequel
1238
1243
  true
1239
1244
  end
1240
1245
 
1246
+ # PostgreSQL 9.3rc1+ supports lateral subqueries
1247
+ def supports_lateral_subqueries?
1248
+ server_version >= 90300
1249
+ end
1250
+
1241
1251
  # PostgreSQL supports modifying joined datasets
1242
1252
  def supports_modifying_joins?
1243
1253
  true
@@ -148,6 +148,11 @@ module Sequel
148
148
  sqlite_version >= 30619
149
149
  end
150
150
 
151
+ # SQLite 3.8.0+ supports partial indexes.
152
+ def supports_partial_indexes?
153
+ sqlite_version >= 30800
154
+ end
155
+
151
156
  # SQLite 3.6.8+ supports savepoints.
152
157
  def supports_savepoints?
153
158
  sqlite_version >= 30608
@@ -47,6 +47,11 @@ module Sequel
47
47
  respond_to?(:indexes)
48
48
  end
49
49
 
50
+ # Whether the database supports partial indexes (indexes on a subset of a table).
51
+ def supports_partial_indexes?
52
+ false
53
+ end
54
+
50
55
  # Whether the database and adapter support prepared transactions
51
56
  # (two-phase commit), false by default.
52
57
  def supports_prepared_transactions?
@@ -90,7 +95,7 @@ module Sequel
90
95
  end
91
96
 
92
97
  private
93
-
98
+
94
99
  # Whether the database supports combining multiple alter table
95
100
  # operations into a single query, false by default.
96
101
  def supports_combining_alter_table_ops?
@@ -716,13 +716,9 @@ module Sequel
716
716
  # and index specifications.
717
717
  def index_definition_sql(table_name, index)
718
718
  index_name = index[:name] || default_index_name(table_name, index[:columns])
719
- if index[:type]
720
- raise Error, "Index types are not supported for this database"
721
- elsif index[:where]
722
- raise Error, "Partial indexes are not supported for this database"
723
- else
724
- "CREATE #{'UNIQUE ' if index[:unique]}INDEX #{quote_identifier(index_name)} ON #{quote_schema_table(table_name)} #{literal(index[:columns])}"
725
- end
719
+ raise Error, "Index types are not supported for this database" if index[:type]
720
+ raise Error, "Partial indexes are not supported for this database" if index[:where] && !supports_partial_indexes?
721
+ "CREATE #{'UNIQUE ' if index[:unique]}INDEX #{quote_identifier(index_name)} ON #{quote_schema_table(table_name)} #{literal(index[:columns])}#{" WHERE #{filter_expr(index[:where])}" if index[:where]}"
726
722
  end
727
723
 
728
724
  # Array of SQL DDL statements, one for each index specification,
@@ -9,12 +9,11 @@ module Sequel
9
9
 
10
10
  # Action methods defined by Sequel that execute code on the database.
11
11
  ACTION_METHODS = (<<-METHS).split.map{|x| x.to_sym}
12
- << [] []= all avg count columns columns! delete each
13
- empty? fetch_rows first first! get import insert insert_multiple interval last
12
+ << [] all avg count columns columns! delete each
13
+ empty? fetch_rows first first! get import insert interval last
14
14
  map max min multi_insert paged_each range select_hash select_hash_groups select_map select_order_map
15
- set single_record single_value sum to_csv to_hash to_hash_groups truncate update
15
+ single_record single_value sum to_hash to_hash_groups truncate update
16
16
  METHS
17
- # REMOVE40 []= insert_multiple set to_csv
18
17
 
19
18
  # Inserts the given argument into the database. Returns self so it
20
19
  # can be used safely when chaining:
@@ -95,6 +95,11 @@ module Sequel
95
95
  true
96
96
  end
97
97
 
98
+ # Whether the dataset supports LATERAL for subqueries in the FROM or JOIN clauses.
99
+ def supports_lateral_subqueries?
100
+ false
101
+ end
102
+
98
103
  # Whether modifying joined datasets is supported.
99
104
  def supports_modifying_joins?
100
105
  false