Skip to content
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

Does not support citext[] in postgres #352

Open
cflipse opened this issue Dec 26, 2019 · 0 comments
Open

Does not support citext[] in postgres #352

cflipse opened this issue Dec 26, 2019 · 0 comments
Labels

Comments

@cflipse
Copy link
Contributor

cflipse commented Dec 26, 2019

Describe the bug

In postgres, citext arrays (citext[]) are not supported consistantly with text arrays (text[]). Both types should be usable.

Currently, text[] is supported as expected; when values are retreived, they are exposed to ruby as string arrays: ["one", "two", "three four"].
citext[] does not perform this same translation; instead results are returned in a native format:
'{"one", "two", "three four"}'

Examining the inferred schema gives no indication of why they behave differently:
text[]:

=> #<ROM::SQL::Attribute[NilClass | Array] name=:tags db_type="text[]" database="postgres" type="text" read=#<Dry::Types[Sum<Constrained<Nominal<NilClass> rule=[type?(NilClass)]> | Constructor<Array fn=/home/flip/.gem/ruby/2.6.4/gems/rom-sql-3.0.1/lib/rom/sql/extensions/postgres/types/array.rb:13>>]> source=ROM::Relation::Name(products) index=true qualified=true sql_expr=#<Sequel::SQL::QualifiedIdentifier @table=>:products, @column=>:tags> alias=nil>

citext[]:

#<ROM::SQL::Attribute[NilClass | Array] name=:tags db_type="citext[]" database="postgres" type="citext" read=#<Dry::Types[Sum<Constrained<Nominal<NilClass> rule=[type?(NilClass)]> | Constructor<Array fn=/home/flip/.gem/ruby/2.6.4/gems/rom-sql-3.0.1/lib/rom/sql/extensions/postgres/types/array.rb:13>>]> source=ROM::Relation::Name(products) index=true qualified=true sql_expr=#<Sequel::SQL::QualifiedIdentifier @table=>:products, @column=>:tags> alias=nil>

To Reproduce

  • generate a postgres table with citext extension enabled.
  • create a table with text[] and citext[] columns
  • use an relation with inferred schema
  • add an array to both colums; note the difference in read results

Expected behavior
citext[] should behave the same as text[]

@cflipse cflipse added the bug label Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant