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

Upserting with Array does not work #38

Open
achiinto opened this issue Jun 20, 2014 · 6 comments
Open

Upserting with Array does not work #38

achiinto opened this issue Jun 20, 2014 · 6 comments

Comments

@achiinto
Copy link

I am using the gem with PostgreSQL and JRuby. Have anyone tried doing Upsert with Integer[] or character varying(255)[]? I can't seem to get it work and always getting:

"Hint: No function matches the given name and argument types. You might need to add explicit type casts."

When the same table is not upset with array attribute, everything worked fine. But when the array attributes are included, it failed. The "function" creation has integer[] and character varying(255)[] respectively, while the result sql has values "{'12345','23456'}" for the integer[] and "{'test','test2'}" for the string[].

Does it look right?

@achiinto
Copy link
Author

It seems that's the problem caused by having the array values as "{'12345','23456'}" and "{'test','test2'}", instead of '{"12345","23456"}' and '{"test","test2"}'. And integer[] should looks like '{12345,23456}' instead anyway.

@seamusabshere
Copy link
Owner

hi @achiinto would you show some sample code?

also please show the table structure (using \d TABLENAME in psql)

@achiinto
Copy link
Author

achiinto commented Jul 8, 2014

hi @seamusabshere, sorry that I have been busy. My project currently is not using the gem anymore. But at soon as I can get back to it, I will try to reproduce it in a brand new project to verify the issue.

@seamusabshere
Copy link
Owner

@achiinto would love to see a test, after which we can probably support this functionality using http://rubygems.org/gems/pg_array

@achiinto
Copy link
Author

I have some free time now, let me get back to it. I am getting curious too.

@evadne
Copy link
Contributor

evadne commented Jun 3, 2015

Is this still an issue? Postgres arrays work okay with Rails 4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants