Support for PostgreSQL citext data type. #12523

Merged
merged 1 commit into from Mar 11, 2014

Conversation

Projects
None yet
9 participants
@lsylvester
Contributor

lsylvester commented Oct 14, 2013

citext makes it possible to use AR Hash finders for case-insensitive
matching as sql UPPER/LOWER functions are not needed.

This is an updated version of #9182 and #10231.

The schema.rb dumps now include citext columns and unknown OID warning that appeared in the test has been fixed by reconnecting to the database after the extension was enabled.

@@ -111,6 +111,15 @@
_SQL
end
+ if 't' == select_value("select 'citext'=ANY(select typname from pg_type)")
+ execute <<_SQL

This comment has been minimized.

@pftg

pftg Oct 14, 2013

Contributor

May you indent this code.

@pftg

pftg Oct 14, 2013

Contributor

May you indent this code.

This comment has been minimized.

@lsylvester

lsylvester Oct 14, 2013

Contributor

None of the other create table statements in this file are indented. I think that it would be best to indent them all in a separate pull request if having them indented is preferred.

@lsylvester

lsylvester Oct 14, 2013

Contributor

None of the other create table statements in this file are indented. I think that it would be best to indent them all in a separate pull request if having them indented is preferred.

This comment has been minimized.

@pftg

pftg Oct 14, 2013

Contributor

That PR will be rejected, as cosmetic changes. Better way to use code style for current changes.

@pftg

pftg Oct 14, 2013

Contributor

That PR will be rejected, as cosmetic changes. Better way to use code style for current changes.

This comment has been minimized.

@rafaelfranca

rafaelfranca Oct 14, 2013

Member

It is fine in the way it is. I already tried to change the style on this file and I don't think it is worth

@rafaelfranca

rafaelfranca Oct 14, 2013

Member

It is fine in the way it is. I already tried to change the style on this file and I don't think it is worth

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Oct 14, 2013

Member

This pull request needs a rebase

Member

rafaelfranca commented Oct 14, 2013

This pull request needs a rebase

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Oct 14, 2013

Member

Could you add a test for the schema.rb dump. I didn't saw this being tested

Member

rafaelfranca commented Oct 14, 2013

Could you add a test for the schema.rb dump. I didn't saw this being tested

@lsylvester

This comment has been minimized.

Show comment
Hide comment
@lsylvester

lsylvester Oct 14, 2013

Contributor

Rebased, and test for schema.rb dump has been added

Contributor

lsylvester commented Oct 14, 2013

Rebased, and test for schema.rb dump has been added

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Dec 3, 2013

Member

@rafaelfranca do you have anything else to add here?

@rafaelfranca do you have anything else to add here?

@robin850

This comment has been minimized.

Show comment
Hide comment
@robin850

robin850 Dec 7, 2013

Member

@carlosantoniodasilva @rafaelfranca : What do you think about improving the documentation and adding a note about this feature in the "Ruby on Rails 4.1 Release Notes" guide (if this will be in 4.1) ?

Member

robin850 commented Dec 7, 2013

@carlosantoniodasilva @rafaelfranca : What do you think about improving the documentation and adding a note about this feature in the "Ruby on Rails 4.1 Release Notes" guide (if this will be in 4.1) ?

@exviva

This comment has been minimized.

Show comment
Hide comment
@exviva

exviva Dec 10, 2013

Contributor

I'd also be interested in getting this merged. Anything I can do to help?

Contributor

exviva commented Dec 10, 2013

I'd also be interested in getting this merged. Anything I can do to help?

@jalada

This comment has been minimized.

Show comment
Hide comment
@jalada

jalada Dec 18, 2013

👍 I'm sad this got missed from 4.1; I'm getting bored of the citext errors in my console when I use it manually.

jalada commented Dec 18, 2013

👍 I'm sad this got missed from 4.1; I'm getting bored of the citext errors in my console when I use it manually.

+ assert_equal('Cased Text', x.cival)
+ end
+end
+

This comment has been minimized.

activerecord/CHANGELOG.md
@@ -1,3 +1,8 @@
+* Support for Postgres citext data type enabling case-insensitive where
+ values without needing to wrap in UPPER/LOWER sql functions

This comment has been minimized.

@carlosantoniodasilva

carlosantoniodasilva Dec 18, 2013

Member

PostgreSQL. citext with wrapped backticks for highlight. And please end with ..

@carlosantoniodasilva

carlosantoniodasilva Dec 18, 2013

Member

PostgreSQL. citext with wrapped backticks for highlight. And please end with ..

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Dec 18, 2013

Member

Can you rebase this from master? Thanks.

@rafaelfranca mind taking a look here? ❤️

Can you rebase this from master? Thanks.

@rafaelfranca mind taking a look here? ❤️

@lsylvester

This comment has been minimized.

Show comment
Hide comment
Contributor

lsylvester commented Dec 18, 2013

@@ -371,6 +371,7 @@ def self.registered_type?(name)
register_type 'circle', OID::Identity.new
register_type 'hstore', OID::Hstore.new
register_type 'json', OID::Json.new
+ register_type 'citext', OID::Identity.new

This comment has been minimized.

@senny

senny Mar 8, 2014

Member

we should map it to OID::Text.new

@senny

senny Mar 8, 2014

Member

we should map it to OID::Text.new

@senny

This comment has been minimized.

Show comment
Hide comment
@senny

senny Mar 8, 2014

Member

@lsylvester can you push a rebased and squashed version of this PR? You can use brackets in the commit message to give credits to the authors:

git commit -m "register OID for PostgreSQL citex datatype [Author A & Author B]"
Member

senny commented Mar 8, 2014

@lsylvester can you push a rebased and squashed version of this PR? You can use brackets in the commit message to give credits to the authors:

git commit -m "register OID for PostgreSQL citex datatype [Author A & Author B]"
@lsylvester

This comment has been minimized.

Show comment
Hide comment
@lsylvester

lsylvester Mar 10, 2014

Contributor

@senny I have rebased

Contributor

lsylvester commented Mar 10, 2014

@senny I have rebased

@senny

This comment has been minimized.

Show comment
Hide comment
@senny

senny Mar 10, 2014

Member

@lsylvester can we include citex_test.rb as the two referenced PR's do?

Member

senny commented Mar 10, 2014

@lsylvester can we include citex_test.rb as the two referenced PR's do?

register OID for PostgreSQL citex datatype [Troy Kruthoff & Lachlan S…
…ylvester]

citext makes it possible to use AR Hash finders for case-insensitive matching as sql UPPER/LOWER functions are not needed.
@lsylvester

This comment has been minimized.

Show comment
Hide comment
@lsylvester

lsylvester Mar 10, 2014

Contributor

@senny I have added a citext_test.rb.

Contributor

lsylvester commented Mar 10, 2014

@senny I have added a citext_test.rb.

@senny senny removed the openacademy label Mar 11, 2014

senny added a commit that referenced this pull request Mar 11, 2014

Merge pull request #12523 from lsylvester/pg_citext
Support for PostgreSQL citext data type.

@senny senny merged commit 0e0b41d into rails:master Mar 11, 2014

1 check passed

default The Travis CI build passed
Details
@senny

This comment has been minimized.

Show comment
Hide comment
@senny

senny Mar 11, 2014

Member

@lsylvester thank you for your patience 💛

Member

senny commented Mar 11, 2014

@lsylvester thank you for your patience 💛

tenderlove added a commit that referenced this pull request Mar 13, 2014

Merge branch 'master' into adequaterecord
* master: (108 commits)
  make tests pass on Ruby 2.2
  Use Sqlite3 adapter in examples
  use the body proxy to freeze headers
  just ask the response for the commit status, we do not need to ask the jar
  only write the jar if the response isn't committed
  Fix a grammatical error in the i18n guide [ci skip]
  use method_defined? to check whether or not a method is defined
  Enhance docs for update_attribute [ci-skip]
  Change usec to 0 on tests that compare seconds
  Unit test for mysql quote time usec
  Changelog entry for mysql56 microseconds
  Test microsecond on mysql 5.6
  MySQL 5.6 and later supports microsecond precision in datetime.
  [ci skip] Add documentation for original_fullpath.
  Remove mocking on save, when not necessary
  comment why we are modifying global state. [ci skip]
  `change_table` supports `citext`. Follow up to #12523.
  Removed unnecessary command "application"
  register OID for PostgreSQL citex datatype [Troy Kruthoff & Lachlan Sylvester]
  Fixes STI when 2+ levels deep.
  ...

@jonatack jonatack referenced this pull request in activerecord-hackery/ransack Mar 28, 2014

Closed

Postgres UNACCENT() for cont, not_count, start, not_start... #349

@prathamesh-sonpatki prathamesh-sonpatki referenced this pull request in exercism/exercism.io Mar 22, 2015

Merged

Bump to use ActiveRecord and ActiveSupport 4.2.1 #2249

prathamesh-sonpatki added a commit to prathamesh-sonpatki/exercism.io that referenced this pull request Mar 22, 2015

Bump to use ActiveRecord and ActiveSupport 4.2.1
 - The registering of citext is no longer required because Rails 4.2
   added support for it in rails/rails#12523.
 - Also Rails 4.2 has locked minitest version to 5.5.1 so removed
   locking it to lower version in test_helper.

prathamesh-sonpatki added a commit to prathamesh-sonpatki/exercism.io that referenced this pull request Mar 22, 2015

Bump to use ActiveRecord and ActiveSupport 4.2.1
 - The registering of citext is no longer required because Rails 4.2
   added support for it in rails/rails#12523.
 - Also Rails 4.2 has locked minitest version to 5.5.1 so removed
   locking it to lower version in test_helper.

trayo added a commit to trayo/exercism.io that referenced this pull request May 11, 2015

Bump to use ActiveRecord and ActiveSupport 4.2.1
 - The registering of citext is no longer required because Rails 4.2
   added support for it in rails/rails#12523.
 - Also Rails 4.2 has locked minitest version to 5.5.1 so removed
   locking it to lower version in test_helper.

treiff added a commit to treiff/exercism.io that referenced this pull request Aug 6, 2015

Bump to use ActiveRecord and ActiveSupport 4.2.1
 - The registering of citext is no longer required because Rails 4.2
   added support for it in rails/rails#12523.
 - Also Rails 4.2 has locked minitest version to 5.5.1 so removed
   locking it to lower version in test_helper.

treiff added a commit to treiff/exercism.io that referenced this pull request Aug 15, 2015

Bump to use ActiveRecord and ActiveSupport 4.2.1
 - The registering of citext is no longer required because Rails 4.2
   added support for it in rails/rails#12523.
 - Also Rails 4.2 has locked minitest version to 5.5.1 so removed
   locking it to lower version in test_helper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment