Code Monkey home page Code Monkey logo

Comments (10)

tjikkun avatar tjikkun commented on May 27, 2024 2

Sorry, not my best bug report ever :)
It was postgres 16.2 on debian (docker container) and PHP 8.3.
I found that the query from getTableColumnsSQL is the issue:

SELECT a.attname AS "COLUMN_NAME", case when a.attnotnull then 'NO' else 'YES' end as "IS_NULLABLE", pg_catalog.format_type(a.atttypid, -1) as "DATA_TYPE", case when a.atttypmod < 0 then NULL else a.atttypmod-4 end as "CHARACTER_MAXIMUM_LENGTH", case when a.atttypid != 1700 then NULL else ((a.atttypmod - 4) >> 16) & 65535 end as "NUMERIC_PRECISION", case when a.atttypid != 1700 then NULL else (a.atttypmod - 4) & 65535 end as "NUMERIC_SCALE", '' AS "COLUMN_TYPE" FROM pg_attribute a JOIN pg_class pgc ON pgc.oid = a.attrelid WHERE pgc.relname = 'domains' AND '' <> 'domains' AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum;

This always returns data, even if you don't have a domains table (but when you do have that table this becomes an issue).

It did just ran the tests, they complete fine, but there is no domains table there :)

from php-crud-api.

tjikkun avatar tjikkun commented on May 27, 2024 1

Yes, latest master works, nice!

from php-crud-api.

mevdschee avatar mevdschee commented on May 27, 2024 1

Released in v2.14.26

from php-crud-api.

mevdschee avatar mevdschee commented on May 27, 2024

Thank you for reporting this issue.

It seems it pulls in column names that are internal to postgres domains.

Yes, please report the postgres version you are running. Please also report other relevant versions (OS, PHP, etc).

NB: Did you run the tests?

from php-crud-api.

mevdschee avatar mevdschee commented on May 27, 2024

but there is no domains table there :)

This domains thing is something new in PostgreSQL? Do you know what the pg_attribute and pg_class views look like causing this failure? Probably there is some internal table called domains, right?

from php-crud-api.

mevdschee avatar mevdschee commented on May 27, 2024

Can you test the latest master?

from php-crud-api.

mevdschee avatar mevdschee commented on May 27, 2024

Somehow the namespaces outside public where also evaluated. I restricted all reflection to the 'public' namespace, while I can imagine that people have other namespaces than public, so maybe it needs to be configurable.

from php-crud-api.

mevdschee avatar mevdschee commented on May 27, 2024

This shows the namespaces:

php-crud-api=# select distinct relnamespace::regnamespace::text from pg_class;
    relnamespace    
--------------------
 public
 pg_catalog
 pg_toast
 information_schema
(4 rows)

And the namespace that causes the problem:

php-crud-api=# select relnamespace::regnamespace::text from pg_class where relname = 'domains';
    relnamespace    
--------------------
 information_schema
(1 row)

Maybe the excluding condition should be:

relnamespace::regnamespace::text !~ '^pg_|information_schema'

What do you think?

from php-crud-api.

mevdschee avatar mevdschee commented on May 27, 2024

Can you test the latest master?

from php-crud-api.

mevdschee avatar mevdschee commented on May 27, 2024

@tjikkun Dankjewel voor je bijdrage / Thank you for your contribution!

from php-crud-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.