nonsapiens / realaddressfactory

Generates real-world addresses for use in seeding or test. Laravel 11+, and supports Faker.
46 stars 3 forks source link

Cache issue with Laravel 10.32.0+ #3

Closed StanProg closed 3 months ago

StanProg commented 9 months ago

Laravel: 10.32.0; PHP: 8.2.1; DB: PostgreSQL 15.3 (Debian 15.3-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit; RealAddress Generator: 2.0.2

I found an issue and tracked it down to Laravel 10.32.0: https://github.com/laravel/framework/releases/tag/v10.32.0. They've changed something in this version that brakes realaddressfactory. I suppose it's this PR: https://github.com/laravel/framework/pull/48968

The code that generates this error is:

$lookup = app('geocoder')->geocode($query)->get()->first();

\The generated error is the following:


SQLSTATE[42P10]: Invalid column reference: 7 ERROR:  there is no unique or exclusion constraint matching the ON CONFLICT specification (Connection: pgsql, SQL: insert into "cache" ("key", "value", "expiration") values (..., ...=, 1717135847) on conflict ("key") do update set "key" = "excluded"."key", "value" = "excluded"."value", "expiration" = "excluded"."expiration") {"exception":"[object] (Illuminate\\Database\\QueryException(code: 42P10): SQLSTATE[42P10]: Invalid column reference: 7 ERROR:  there is no unique or exclusion constraint matching the ON CONFLICT specification (Connection: pgsql, SQL: insert into \"cache\" (\"key\", \"value\", \"expiration\") values (...0=, 1717135847) on conflict (\"key\") do update set \"key\" = \"excluded\".\"key\", \"value\" = \"excluded\".\"value\", \"expiration\" = \"excluded\".\"expiration\") at /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php:822)
[stacktrace]
#0 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php(776): Illuminate\\Database\\Connection->runQueryCallback()
#1 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php(593): Illuminate\\Database\\Connection->run()
#2 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3506): Illuminate\\Database\\Connection->affectingStatement()
#3 /vagrant/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php(139): Illuminate\\Database\\Query\\Builder->upsert()
#4 /vagrant/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(217): Illuminate\\Cache\\DatabaseStore->put()
#5 /vagrant/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(399): Illuminate\\Cache\\Repository->put()
#6 /vagrant/vendor/toin0u/geocoder-laravel/src/ProviderAndDumperAggregator.php(206): Illuminate\\Cache\\Repository->remember()
#7 /vagrant/vendor/toin0u/geocoder-laravel/src/ProviderAndDumperAggregator.php(101): Geocoder\\Laravel\\ProviderAndDumperAggregator->cacheRequest()
#8 /vagrant/vendor/nonsapiens/realaddressfactory/src/RealAddressFactory.php(161): Geocoder\\Laravel\\ProviderAndDumperAggregator->geocode()
#9 /vagrant/vendor/nonsapiens/realaddressfactory/src/RealAddressFactory.php(113): Nonsapiens\\RealAddressFactory\\RealAddressFactory->make()
#10 /vagrant/app/Console/Commands/T.php(59): Nonsapiens\\RealAddressFactory\\RealAddressFactory->makeGermany()
#11 /vagrant/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Console\\Commands\\T->handle()
#12 /vagrant/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#13 /vagrant/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#14 /vagrant/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#15 /vagrant/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#16 /vagrant/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#17 /vagrant/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#18 /vagrant/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#19 /vagrant/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run()
#20 /vagrant/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()
#21 /vagrant/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()
#22 /vagrant/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#23 /vagrant/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#24 {main}

[previous exception] [object] (PDOException(code: 42P10): SQLSTATE[42P10]: Invalid column reference: 7 ERROR:  there is no unique or exclusion constraint matching the ON CONFLICT specification at /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php:605)
[stacktrace]
#0 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php(605): PDOStatement->execute()
#1 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php(809): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}()
#2 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php(776): Illuminate\\Database\\Connection->runQueryCallback()
#3 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php(593): Illuminate\\Database\\Connection->run()
#4 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3506): Illuminate\\Database\\Connection->affectingStatement()
#5 /vagrant/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php(139): Illuminate\\Database\\Query\\Builder->upsert()
#6 /vagrant/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(217): Illuminate\\Cache\\DatabaseStore->put()
#7 /vagrant/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(399): Illuminate\\Cache\\Repository->put()
#8 /vagrant/vendor/toin0u/geocoder-laravel/src/ProviderAndDumperAggregator.php(206): Illuminate\\Cache\\Repository->remember()
#9 /vagrant/vendor/toin0u/geocoder-laravel/src/ProviderAndDumperAggregator.php(101): Geocoder\\Laravel\\ProviderAndDumperAggregator->cacheRequest()
#10 /vagrant/vendor/nonsapiens/realaddressfactory/src/RealAddressFactory.php(161): Geocoder\\Laravel\\ProviderAndDumperAggregator->geocode()
#11 /vagrant/vendor/nonsapiens/realaddressfactory/src/RealAddressFactory.php(113): Nonsapiens\\RealAddressFactory\\RealAddressFactory->make()
#12 /vagrant/app/Console/Commands/T.php(59): Nonsapiens\\RealAddressFactory\\RealAddressFactory->makeGermany()
#13 /vagrant/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Console\\Commands\\T->handle()
#14 /vagrant/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#15 /vagrant/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#16 /vagrant/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#17 /vagrant/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#18 /vagrant/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#19 /vagrant/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#20 /vagrant/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#21 /vagrant/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run()
#22 /vagrant/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()
#23 /vagrant/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()
#24 /vagrant/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#25 /vagrant/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#26 {main}
"}

   Illuminate\Database\QueryException
  SQLSTATE[42P10]: Invalid column reference: 7 ERROR:  there is no unique or exclusion constraint matching the ON CONFLICT specification (Connection: pgsql, SQL: insert into "cache" ("key", "value", "expiration") values (..., ...=, 1717135847) on conflict ("key") do update set "key" = "excluded"."key", "value" = "excluded"."value", "expiration" = "excluded"."expiration")

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:822
    818▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    819▕                 );
    820▕             }
    821▕
  ➜ 822▕             throw new QueryException(
    823▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    824▕             );
    825▕         }
    826▕     }
StanProg commented 3 months ago

The issue is not related to this package.