HuasoFoundries/phpPgAdmin6

column "oid" does not exist

klaxian opened this issue · 2 comments

When attempting to browse any table that does not use OIDs, the following error prevents results from being displayed. The auto-generated select query attempts to retrieve column "oid", which does not exist. This did not happen with older betas.

ERROR: column "oid" does not exist

It just happened to me too. Will fix it tomorrow.

Ok, I found the root cause. I spend the last few days refactoring class Postgres.php (~ 12.000 lines of code) That class was a pain to debug and even sublimetext took like 30 seconds to save it on every edition, besides being one of the worst rated classes in the project:

https://scrutinizer-ci.com/g/HuasoFoundries/phpPgAdmin6/code-structure/develop/class/PHPPgAdmin%5CDatabase%5CPostgres

I separated it into traits (one for tables, another for views, indexes, and so on, since there is no multiple inheritance in PHP and I didn't want to introduce interfaces into the project...). The class is now about 3000 lines long, but refactoring sometimes break things, and it's not easy to implement unit tests for what is meant to be a connector unless you either spawn a postgres instance on each run (which I intend to do) or mock the hell out of everything.

Whatever. While refactoring I found a method that converts a database boolean into a php boolean.

"That's dump" I thought. False and true are the same kind of constant in both worlds. And they are, if you work with PDO or with any native PG driver, but not with AdoDB. Turns out that a FALSE Postgres result is returned in AdoDB response as f. So, well, it turns out the dumb function that returned ($parameter === 't') wasn't dumb. It's ugly, but I am the dumb one.

I just released beta 44.

Didn't get much sleep but coded this MF bug to hell and beyond.