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

Postgres 12 Compatibility #133

Closed
arcreative opened this issue May 1, 2020 · 9 comments
Closed

Postgres 12 Compatibility #133

arcreative opened this issue May 1, 2020 · 9 comments

Comments

@arcreative
Copy link

Looks like this gem doesn't work with Postgres 12--I'm in the awkward phase where I've upgraded my local PG, but I haven't yet upgraded our application to Rails 6 to take advantage of the native upsert. The error is as follows:

E, [2020-04-30T18:36:54.088206 #16051] ERROR -- : PG::UndefinedColumn: ERROR:  column d.adsrc does not exist
LINE 1: ...format_type(a.atttypid, a.atttypmod) AS sql_type, d.adsrc AS...
                                                             ^

E, [2020-04-30T18:36:54.088250 #16051] ERROR -- : Backtrace:
E, [2020-04-30T18:36:54.088307 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert/connection/PG_Connection.rb:13:in `async_exec'
E, [2020-04-30T18:36:54.088355 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert/connection/PG_Connection.rb:13:in `execute'
E, [2020-04-30T18:36:54.088401 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert/column_definition/postgresql.rb:8:in `all'
E, [2020-04-30T18:36:54.088457 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert.rb:240:in `column_definitions'
E, [2020-04-30T18:36:54.088496 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert/merge_function.rb:59:in `column_definitions'
E, [2020-04-30T18:36:54.088533 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert/merge_function.rb:65:in `validate!'
E, [2020-04-30T18:36:54.088570 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert/merge_function.rb:38:in `initialize'
E, [2020-04-30T18:36:54.088649 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert/merge_function/postgresql.rb:47:in `initialize'
E, [2020-04-30T18:36:54.088689 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert.rb:230:in `new'
E, [2020-04-30T18:36:54.088726 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert.rb:230:in `merge_function'
E, [2020-04-30T18:36:54.088761 #16051] ERROR -- : /Users/arob/.rvm/gems/ruby-2.6.5/gems/upsert-2.2.1/lib/upsert.rb:219:in `row'
@pnomolos
Copy link
Collaborator

pnomolos commented May 1, 2020

Hi @arcreative can you please try upgrading to 2.99? It should fix your error. (I might have to cut a release if it’s not on rubygems yet).

@arcreative
Copy link
Author

@pnomolos I don't see a tag for that--is there something I'm missing?

@arcreative
Copy link
Author

Nevermind--I see you're versioning but not tagging. 2.9.10 looks like it's working better.

@arcreative
Copy link
Author

@pnomolos I'm seeing some null constraint errors with some of the newer changes here... I would love to dive into it further, but I don't really have time to install an older version of PG right now to investigate, unfortunately...

@pnomolos
Copy link
Collaborator

pnomolos commented May 1, 2020

@arcreative I saw that myself on one of our projects but I’m using Sequel and was in a rush so just converted to native Upsert. Any chance you can send me a small test case? I’m running PG10 through 12 so I can test it 😁

@pnomolos
Copy link
Collaborator

pnomolos commented May 1, 2020

@arcreative Even a backtrace and the table creation statement should be enough, if you’re able to share that 👍

@sgeef
Copy link

sgeef commented May 1, 2020

@arcreative sounds very simular yto the issue i had when upgrading to pg12 and while upgrading the gem. #117 (comment)

Basically in the older verdion the gem had a bug that used the custom created function to upsert, which is compatible with update only upserts, with missing not null values. While the pg_native approach does not accept that, which is probably failing now.

@arcreative
Copy link
Author

I stopped being lazy and installed the postgres:10 Docker image--it's definitely failing with null constraints for the native method where it wasn't with the upsert function. I think I'll just stick with this Postgres 10 solution on 2.2.1 for now and upgrade when I have more time.

Thanks for the info, and would definitely get a new gem cut if you're planning on keeping it this way, but I'm not sure that I would slate this as a non-breaking change, so you might want to bump it to 3.0 as of when you implemented the native upsert function.

@pnomolos
Copy link
Collaborator

Fixed via #138

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