Commits on Mar 14, 2018
  1. Free temporary clobs in the jdbc/oracle adapter to prevent a memory l…

    jeremyevans committed Mar 14, 2018
    …eak (Fixes #1482)
    Leave it to Oracle to force you to do something manually that should
    be handled automatically.
Commits on Mar 11, 2018
  1. Treat prepared statement errors due to changing types as disconnect e…

    jeremyevans committed Mar 11, 2018
    …rrors (Fixes #1481)
    While these are not technically disconnect errors, treating them
    as disconnect errors makes sense because it is likely to decrease
    the total number of exceptions that occur if the type of a returned
    column (or the number of columns) changes at runtime.
    In general, if you want to make schema changes and use prepared
    statements, it's best to make sure your prepared statements never
    use a wildcard select, and that none of your schema changes change
    the type of a column or expression returned by a prepared statement.
Commits on Mar 9, 2018
  1. Don't use identity columns by default unless using PostgreSQL 10.2+

    jeremyevans committed Mar 8, 2018
    There is a bug in 10 and 10.1 that causes add_primary_key to fail
    when identity columns are the default.
Commits on Mar 8, 2018
  1. Add integer64 extension for treating Integer as a 64-bit integer when…

    jeremyevans committed Mar 8, 2018
    … used as a generic type
    Among other things, this makes primary_key and foreign_key use
    64-bit integers instead of 32-bit integers by default on most
    You can use the SEQUEL_INTEGER64 environment variable to load this
    extension automatically when running the adapter or integration
    To make PostgreSQL handle this, force a cast for the bitwise shift
    test to make sure it works, as bigint << bigint is not supported.
    Make a small change to a spec that checks for specific oid values.
    Also, base pg_array_associations tests use an array type that
    matches the primary key type used.
  2. Allow many_to_pg_array remove_all_* method cast appropriately to work…

    jeremyevans committed Mar 8, 2018
    … correctly for non-integer types
    Without the casts, PostgreSQL may raise an error because the types
    do not match if bigint[] is used as the foreign key array.
  3. Fix array_type for pg_array_to_many and many_to_pg_array associations…

    jeremyevans committed Mar 8, 2018
    … in pg_array_associations plugin
    The array type should be the scalar type for the array, not the
    actual array type.  Previously, some of the code ended up like
    ARRAY[1]::integer[][], but that didn't break anything because
    integer[][] is considered the same type as integer[].
    As the default type is integer and not integer[], it's best to
    make sure the value is consistent. Additionally, the array_type
    may be used to infer the type of the primary key that the foreign
    keys reference, and in that case the scalar type must be used.
Commits on Mar 7, 2018
  1. Use identity columns instead of serial columns for primary keys on Po…

    jeremyevans committed Mar 7, 2018
    …stgreSQL 10+
    Identity columns are the recommended way to implement autoincrementing
    primary keys going forward.  They fix various issues with the previous
    approach to using serial columns, such as:
    * You no longer need to GRANT USAGE on the primary key sequence
      separately, this is now handled by GRANT INSERT on the table itself.
    * Dropping the default value for the serial column does not drop
      the related sequence.
    * CREATE TABLE LIKE has the two tables share a sequence.
    * You can alter an identity columns sequence data using ALTER COLUMN
      with the column name instead of ALTER SEQUENCE with the
      autogenerated sequence name.
    Other than corner cases that are really workarounds for issues with
    using serial columns, switching from serial to identity by default
    should not cause problems.  No changes to the tests are needed for
    this to work.  This does add two specs for testing the recent
    support for column :identity options and overriding_*_value methods.
    While I don't think this should cause significant problems for most
    applications using Sequel, it is possible this cause small backwards
    compatibility issues.  If people do find this breaks things and they
    want to continue using serial even on PostgreSQL 10, I can add a
    method that forces the use of serial instead of identity by default
    for primary keys.
  2. Support :identity option when creating columns on PostgreSQL 10+ to c…

    jeremyevans committed Mar 7, 2018
    …reate identity columns
    This allows creation of identity columns, by default using
    GENERATED BY DEFAULT AS IDENTITY, but with the :always value,
    GENERATED ALWAYS AS IDENTITY, which doesn't allow user provided
    values for the column to be used when inserting (unless
    Because it doesn't make sense to use an identity column if a
    default value is given, as an identity column is really just a
    column with the default value being an identity sequence, the
    :identity option is ignored if the :default option is present.
  3. Add Dataset#overriding_{system,user}_value on PostgreSQL for use with…

    jeremyevans committed Mar 7, 2018
    … PostgreSQL 10+ identity columns
    These allow either ignoring a given value for an identity column
    (overriding_user_value), or for identity columns using GENERATED
    ALWAYS, allows inserting a user supplied value
  4. Set :auto_increment schema entry correctly for PostgreSQL 10+ identit…

    jeremyevans committed Mar 7, 2018
    …y columns
    Identity columns are new and are designed to replace the previous
    serial columns.  Instead of using a nextval sequence value, there
    is a new entry in the system tables for whether each column is an
    identity column, and all identity columns should be considered
Commits on Mar 6, 2018
Commits on Mar 5, 2018
Commits on Mar 1, 2018
  1. Move Sequel <4 CHANGELOG entries to doc/CHANGELOG.old

    jeremyevans committed Mar 1, 2018
    Don't ship CHANGELOG.old in gem, reduces gem size by another 5%.
  2. Don't ship Sequel 1-3 release notes in gem

    jeremyevans committed Mar 1, 2018
    This saves about 13% of the gem size, and release notes from
    versions that old are unlikely to be helpful to most gem users.
  3. Bump version to 5.6.0

    jeremyevans committed Mar 1, 2018
Commits on Feb 25, 2018
  1. Dedup :db_type strings in schema hashes on Ruby 2.5+

    jeremyevans committed Feb 25, 2018
    This saves memory in applications that where the same database
    type is used more than once, which is most applications.  However,
    the total savings is probably no more than total number of columns
    in all schema caches * 40 bytes, so this is unlikely to result in
    a huge savings.
  2. Freeze string valuse in hashes returned by Database#schema when using…

    jeremyevans committed Feb 25, 2018
    … the schema_caching extension
    This adds a Database#schema_post_process private method that is
    called with the schema array before the schema is cached.  It has
    schema_caching call schema_post_process method on each schema
    array before returning from load_schema_cache.
Commits on Feb 22, 2018
  1. Protect migration file loading with a mutex to not break when multipl…

    jeremyevans committed Feb 21, 2018
    …e threads load migration files simultaneously
    I never considered people would actually do this, but it's possible
    that migrators could be run on different databases at the same time
    in different threads, and it's nice to have that work correctly.
    This removes the private remove_migration_classes method, no longer
    needed.  It changes the behavior for load_migration_file to return
    the migration class/object loaded from the migration file, and not
    just populate Migration.descendants.  This is backwards
    incompatible for any code that accesses Migration.descendants
    expecting it to contain the migration classes, but hopefully
    nobody is doing that.
    This modifies the specs slightly to use Database instance variables
    instead of class constants to store tables and migration files,
    which is necessary for the multithreading to work.
Commits on Feb 16, 2018
  1. Shadowing outer local variable v

    utilum committed Feb 16, 2018
    Ruby 2.5 warns about this.
Commits on Feb 9, 2018
Commits on Feb 6, 2018
  1. Respect identifier mangling rules when renaming columns on Microsoft …

    jeremyevans committed Feb 6, 2018
    …SQL Server
    By default, Microsoft SQL Server identifiers are not case sensitive,
    but they can be if the default database collation is changed.  If
    case sensitive identifiers are used, or custom identifier mangling
    is used, this allows alter_table rename_column to work as expected.
Commits on Jan 31, 2018
  1. Bump version to 5.5.0

    jeremyevans committed Jan 31, 2018
Commits on Jan 29, 2018
Commits on Jan 26, 2018
  1. Bump copyright year

    jeremyevans committed Jan 26, 2018
Commits on Jan 21, 2018
  1. Make Database#copy_table in the postgres adapter handle errors that o…

    jeremyevans committed Jan 21, 2018
    …ccur while processing rows (Fixes #1470)
    Similar to other partial copy errors, this results in a
    disconnection, because attempting to handle it can cause problems
    for later queries.
Commits on Jan 20, 2018
  1. Cache results of changed_columns method in local variables in many pl…

    jeremyevans committed Jan 20, 2018
    …aces for better performance
    There were many cases previously where changed_columns would be
    called in a loop.  In the base support, that's not too bad as it
    is a fairly simple method, but the modification detection plugins
    add substantial processing to it.  Caching the results to a local
    variable before using them in a loop should make all usage faster.
    Additionally, add _add_changed_column and _changed_columns private
    methods.  changed_columns now just calls _changed_columns, and in
    some cases where any extra processing in changed_columns would
    not be helpful, _changed_columns is used directly.
    _add_changed_column adds the column to _changed_columns if it
    isn't already present,  which DRYs up things in a few places.