You're right. Actually, the problem seems to be the resulting query, specifically that the table is in caps:
SELECT NULL AS "NIL" FROM "RECORDS" LIMIT 1 The same query generated for CRuby/postgres is SELECT NULL AS "nil" FROM "records" LIMIT 1 And the generation seems to be all done on sequel side. I've tracked this down to sequel/dataset/sql.rb, where SQL is effectively generated. When passed the source ":records", it goes down this list of methods: source_list_append literal_append literal_symbol_append quote_identifier_append input_identifier This last one effectively upcases :records to "RECORDS" (the sql.rb method). I've seen that this is overriden in share/postgres, through inclusion of UnmodifiedIdentifiers module. However, this isn't happening right now, at least the way I'm defining it. How could this be done then? I think I'm missing the documentation on how best to define a jdbc-postgres adapter. So, if I'm doing this: db = Sequel.connect(adapter: "jdbc", test: false) it's probably not enough to convey that information to sequel. How can I see "jdbc and postgres" adapter? All examples I've found were using complete database uris. quarta-feira, 27 de Maio de 2020 às 01:46:12 UTC+1, Jeremy Evans escreveu: > > > > On Tuesday, May 26, 2020 at 4:23:32 PM UTC-7, Tiago Cardoso wrote: >> >> Hi Jeremy, >> >> I'm working on adding support for jruby in rodauth-rails. I'm starting >> with postgres first. I tried naively to reuse the existing extensions, so >> that one would just call #execute on the activerecord connection ( >> https://github.com/janko/sequel-activerecord_connection/blob/master/lib/sequel/extensions/activerecord_connection/postgres.rb#L5) >> >> . It should just work, but it doesn't. Maybe you can help me find out. So, >> this is how I initiate things: >> >> # activerecord first >> ActiveRecord::Base.establish_connection( >> adapter: "postgresql", >> database: "sequel_activerecord_connection", >> username: "sequel_activerecord_connection", >> password: "sequel_activerecord_connection", >> ) >> # sequel then >> db = Sequel.connect(adapter: "jdbc", test: false) >> db.extension :activerecord_connection >> >> # and then, I create a table >> db.create_table! :records do >> primary_key :id >> String :col >> Time :time >> end >> >> Once I do that, I get an error: >> >> D, [2020-05-26T14:18:37.927562 #68278] DEBUG -- : (1.0ms) BEGIN >> TRANSACTION >> D, [2020-05-26T14:18:37.955206 #68278] DEBUG -- : (18.0ms) SELECT >> NULL AS "NIL" FROM "RECORDS" LIMIT 1 >> D, [2020-05-26T14:18:37.964119 #68278] DEBUG -- : (3.4ms) ROLLBACK >> TRANSACTION >> E >> >> Fabulous run in 18.546650s, 0.0539 runs/s, 0.0000 assertions/s. >> >> 1) Error: >> postgres connection#test_0001_supports Dataset#insert: >> ActiveRecord::JDBCError: org.postgresql.util.PSQLException: ERROR: >> relation "RECORDS" does not exist >> > > Sequel should not attempt to rescue ActiveRecord::JDBCError, because it > does not depend on ActiveRecord. This is probably something that needs to > be handled by sequel-activerecord_connection. > > Thanks, > Jeremy > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/64ef4c97-4787-4ff9-aa8e-bf2c071e4841%40googlegroups.com.
