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

Old code update for pgsql/Schema.php #20343

Closed

Conversation

olegbolden
Copy link

Minor fixes to get rid of "Undefined index" errors

Q A
Is bugfix? ✔️

Minor fixes to get rid of "Undefined index" errors
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.85%. Comparing base (c447d95) to head (b5fcc81).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #20343   +/-   ##
=========================================
  Coverage     64.85%   64.85%           
  Complexity    11437    11437           
=========================================
  Files           431      431           
  Lines         37199    37199           
=========================================
  Hits          24125    24125           
  Misses        13074    13074           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@samdark
Copy link
Member

samdark commented Mar 20, 2025

Would you please add some tests that fail with current code but do not fail after pull request changes are applied?

@olegbolden
Copy link
Author

olegbolden commented Mar 21, 2025

Would you please add some tests that fail with current code but do not fail after pull request changes are applied? 

Hi, Alexander
Thank you for quick response.
To be precise, I've got "Undefined index: type_scheme" error while upgrading Yii2 from version 2.0.37 to 2.0.48.4:

2025-03-20 15:48:15 [172.18.0.1][513][7460b160c03b6e5d1dc6043b9ebe3821][error][yii\base\ErrorException:8] yii\base\ErrorException: Undefined index: type_scheme in /var/www/vendor/yiisoft/yii2/db/pgsql/Schema.php:597
Stack trace:
#0 /var/www/vendor/yiisoft/yii2/db/pgsql/Schema.php(597): yii\base\ErrorHandler->handleError(8, 'Undefined index...', '/var/www/vendor...', 597, Array)
#1 /var/www/vendor/tigrov/yii2-pgsql/src/Schema.php(160): yii\db\pgsql\Schema->loadColumnSchema(Array)
#2 /var/www/vendor/tigrov/yii2-pgsql/src/Schema.php(123): tigrov\pgsql\Schema->loadColumnSchema(Array)
#3 /var/www/vendor/yiisoft/yii2/db/pgsql/Schema.php(193): tigrov\pgsql\Schema->findColumns(Object(yii\db\TableSchema))

After some investigation I found that this error originated from Sergey Tigrov's extension ( https://github.com/Tigrov/yii2-pgsql ) we are using for about 5 years to process composite Postgres types. I used a bit outdated 1.4.3 version of this extension and this very problem with type_scheme was fixed in the latest 1.4.4 version:

Tigrov/yii2-pgsql@0366d17

After upgrading to version 1.4.4 this error gone away and therefore no changes is actually needed.
But anyway, as far as some indexed variable is considered nullable it should be processed the most safe way. This is up to your team.

@samdark samdark added the pr:request for unit tests Unit tests are needed. label Mar 25, 2025
@samdark samdark closed this Mar 25, 2025
@samdark
Copy link
Member

samdark commented Mar 25, 2025

Thanks for getting back. I think we'll keep code as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:request for unit tests Unit tests are needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants