frioux / DBIx-Class-Helpers

https://metacpan.org/pod/DBIx::Class::Helpers
20 stars 38 forks source link

Version 2.034001 broke results_exist on Oracle #104

Open abraxxa opened 4 years ago

abraxxa commented 4 years ago

See https://github.com/frioux/DBIx-Class-Helpers/issues/54#issuecomment-648212094.

ribasushi commented 4 years ago

Hrm... Since the Oracle tests no longer work (https://github.com/frioux/DBIx-Class-Helpers/commit/d845dfcb4d726bccb4ed900fe1f46a9738d0b640#diff-67f50785d40416a7a7689c5c353f1128): can you please distill this down to a one-liner-ish example and provide the full exception text.

abraxxa commented 4 years ago

It's as simple as $rs->results_exist for any $rs as the generated SQL syntax SELECT EXISTS doesn't exist :rofl:.

ribasushi commented 4 years ago

Given the current state of affairs, I have to write a patch, completely blind, against a database I do not have easy access to. Please either provide a complete PR that solves your case (not a random SO link), OR alternatively provide the exact thing I requested above.

abraxxa commented 4 years ago

Is that sufficient? Devel::REPL run of

say rs('Device')->results_exists;

SELECT * 
  FROM ( 
    SELECT EXISTS( 
        SELECT 42 
          FROM device me
       )
   ) AS _existence_subq
Runtime error: DBD::Oracle::db prepare_cached failed: ORA-00936: missing expression (DBD ERROR: error possibly near <*> indicator at char 23 in 'SELECT * FROM ( SELECT <*>EXISTS (SELECT 42 FROM device me ) ) AS _existence_subq ') [for Statement "SELECT * FROM ( SELECT EXISTS (SELECT 42 FROM device me ) ) AS _existence_subq "]

Trace begun at /home/ahartmai/.plenv/versions/30.0/lib/perl5/site_perl/5.30.0/DBIx/Class/Storage/DBI.pm line 1850
DBIx::Class::Storage::DBI::_prepare_sth('DBIx::Class::Storage::DBI::Oracle::Generic=HASH(0x55f7d782e248)', 'DBI::db=HASH(0x55f7d7f60218)', 'SELECT * FROM ( SELECT EXISTS (SELECT 42 FROM device me ) ) AS _existence_subq ') called at /home/ahartmai/.plenv/versions/30.0/lib/perl5/site_perl/5.30.0/DBIx/Class/Storage/DBI.pm line 1829
ribasushi commented 4 years ago

Is that sufficient

Yep that's perfect, thanks! I'll write something up tomorrow if @frioux or @rabbiveesh don't beat me to it.

rabbiveesh commented 4 years ago

And for all the work I spent making sure the codebase would even try to test it...

ribasushi commented 4 years ago

@rabbiveesh based on history Oracle broke prior to your fixes. I.e. it's been disabled for a while for some unrelated reason, @frioux would know more...

ribasushi commented 4 years ago

@rabbiveesh @abraxxa I see why this was disabled: https://github.com/wnameless/docker-oracle-xe-11g#docker-oracle-xe-11g I suppose one of you could try to fix https://github.com/frioux/DBIx-Class-Helpers/blob/main/maint/run-oracle and then be able to run https://github.com/frioux/DBIx-Class-Helpers/blob/main/maint/dockerprove I am not setup for docker properly, so yet again I'll have to try this towards the weekend, but knowing that the core tests run: would be a good starting point.