dbsrgits / sql-translator

SQL::Translator (SQLFairy)
http://sqlfairy.sourceforge.net/
82 stars 91 forks source link

Release 1.64 collateral damage #169

Closed andk closed 6 months ago

andk commented 8 months ago

Hi veesh, I have two XRefs to fail reports that have a connection to the release 1.64:

It would probably be helpful to the downstream users if you could chime in in those issues and explain what they have to fix.

Thanks!

rabbiveesh commented 8 months ago

Thanks so much, I'll look into these ASAP.

Those links are broken for me tho, could you either double check them or paste the bug reports here?

On Wed, Dec 27, 2023, 10:43 PM andk @.***> wrote:

Hi veesh, I have two XRefs to fail reports that have a connection to the release 1.64:

It would probably be helpful to the downstream users if you could chime in in those issues and explain what they have to fix.

Thanks!

— Reply to this email directly, view it on GitHub https://github.com/dbsrgits/sql-translator/issues/169, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFURPKW4J75CDXAGX5FW5XLYLSB6RAVCNFSM6AAAAABBEXU5ZOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TONZVHE3TSNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

andk commented 8 months ago

Ooops, sorry:

The first link should have been https://rt.cpan.org/Ticket/Display.html?id=150861 and it currently has the following text:

Following two link lead to two test reports with the very same perl on the same machine. Betreen the two reports I upgraded SQL-Translator from 1.63 to 1.64:

And then second link should be https://rt.cpan.org/Ticket/Display.html?id=150866 and it currently has the text:

The following two links lead to two test reports with the very same perl on the same machine. Betreen the two reports I upgraded SQL-Translator from 1.63 to 1.64:

Sorry for the misconstruction of the links.

andk commented 8 months ago

Here is another one: https://github.com/karupanerura/SQL-Translator-Producer-DBIxSchemaDSL/issues/1 which has KARUPA/SQL-Translator-Producer-DBIxSchemaDSL-0.04.tar.gz in the focus

rabbiveesh commented 8 months ago

Thanks so much for the reports! I followed up on each of them.

I'm gonna leave this open for a week, and then we'll close it in the absence of more bug reports.

One of them was a subtlety about overloading, which i suppose we could improve on our side, though i could not get their tests to pass, so i have not made changes on our side anyways

nrdvana commented 6 months ago

The one with DBICx::Indexing is just trying to compare the field with another string. The field object has overloaded '""', but not an overload for 'cmp' which is apparently not autogenerated from '""'. ~I think adding 'cmp' => sub { "$_[0]" cmp "$_[1]" } might fix it.~

Here's a one-liner of how it could be fixed:

perl -E 'package Foo {
   use overload q{""} => sub{ ${$_[0]} },
      q{cmp} => sub { my $cmp= "$_[0]" cmp "$_[1]"; $_[2]? -$cmp : $cmp };
   sub new { my ($class, $x)= @_; bless \$x, $class }
 }
 my $x= Foo->new(1);
 say 5 cmp $x;
 say $x cmp 5;
 say $x cmp 1;
 say $x eq 1;
'
rabbiveesh commented 6 months ago

thanks! I had tried playing around with overload and it wasn't behaving nicely, i'll try out your patch and see

nrdvana commented 6 months ago

With slightly more style:

cmp => sub { ("$_[0]" cmp "$_[1]") * (1 - $_[2]*2) };
rabbiveesh commented 6 months ago

Looking again, DBICx::Indexing is using cmp_deeply, which doesn't seem to respect overloading, so they'll just have to update their test